/* =========================================================
   TheFreePNG — Design System v2
   Tokens · Layout · Header · Footer · Components · Legacy bridge
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Source+Serif+4:opsz,wght@8..60,600;8..60,700;8..60,800&display=swap');

:root {
  --ink: #0b1b33;
  --ink-2: #33415c;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --canvas: #f6f7f9;
  --brand: #0a3d91;
  --brand-dark: #072c6b;
  --accent: #d92d20;
  --accent-dark: #b42318;
  --ok: #067647;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow-md: 0 8px 24px -6px rgba(16,24,40,.12);
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --wrap: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font-ui); line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid rgba(10,61,145,.45); outline-offset: 2px; border-radius: 4px; }
.tf-wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.tf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tf-skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 99999; }
.tf-skip:focus { left: 8px; }

/* ---------- Buttons ---------- */
.tf-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 .92rem/1 var(--font-ui); padding: 12px 20px; border-radius: 10px; border: 1px solid transparent; background: var(--brand); color: #fff; text-decoration: none; cursor: pointer; transition: background .15s, transform .15s, box-shadow .15s; }
.tf-btn:hover { background: var(--brand-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tf-btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.tf-btn--ghost:hover { background: var(--canvas); box-shadow: none; }

/* ---------- Top utility bar ---------- */
.tf-util { background: var(--ink); color: #c7d0e0; font-size: .78rem; }
.tf-util .tf-wrap { display: flex; justify-content: space-between; align-items: center; min-height: 36px; gap: 16px; }
.tf-util a { color: #c7d0e0; text-decoration: none; margin-left: 18px; }
.tf-util a:hover { color: #fff; }

/* ---------- Header ---------- */
.tf-header { position: sticky; top: 0; z-index: 1000; background: rgba(255,255,255,.94); backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--line); }
.tf-header .tf-wrap { display: flex; align-items: center; gap: 28px; min-height: 72px; }
.tf-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.tf-logo img { height: 36px; width: auto; display: block; }
.tf-logo b { font: 800 1.35rem/1 var(--font-ui); letter-spacing: -.02em; }
.tf-logo b span { color: var(--accent); }
.tf-nav { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tf-nav > li { position: relative; }
.tf-nav a.tf-link, .tf-nav button.tf-link { display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; font: 600 .92rem/1 var(--font-ui); color: var(--ink-2); text-decoration: none; background: none; border: 0; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s; }
.tf-nav a.tf-link:hover, .tf-nav button.tf-link:hover, .tf-nav a.is-active { background: #eef3fb; color: var(--brand); }
.tf-drop { display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 8px; margin: 0; list-style: none; }
.tf-nav li:hover > .tf-drop, .tf-nav li:focus-within > .tf-drop, .tf-nav li.is-open > .tf-drop { display: block; }
.tf-drop a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 500; }
.tf-drop a:hover { background: #eef3fb; color: var(--brand); }
.tf-search { margin-left: auto; position: relative; width: min(320px, 100%); }
.tf-search input { width: 100%; height: 42px; padding: 0 14px 0 40px; border: 1px solid var(--line); border-radius: 999px; background: var(--canvas); font: 500 .9rem var(--font-ui); color: var(--ink); transition: border-color .15s, background .15s, box-shadow .15s; }
.tf-search input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(10,61,145,.12); }
.tf-search i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
.tf-burger { display: none; margin-left: auto; width: 44px; height: 44px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font-size: 1.05rem; color: var(--ink); cursor: pointer; }
.tf-scrim { display: none; position: fixed; inset: 0; background: rgba(11,27,51,.55); z-index: 1998; }
.tf-scrim.is-on { display: block; }
.tf-drawer-head { display: none; }

@media (max-width: 980px) {
  .tf-header .tf-wrap { min-height: 64px; gap: 12px; }
  .tf-burger { display: inline-flex; align-items: center; justify-content: center; }
  .tf-panel { position: fixed; top: 0; right: -340px; width: 320px; max-width: 88vw; height: 100%; background: #fff; z-index: 1999; padding: 0 0 24px; overflow-y: auto; transition: right .25s ease; box-shadow: -12px 0 32px rgba(0,0,0,.2); display: flex; flex-direction: column; gap: 8px; }
  .tf-panel.is-open { right: 0; }
  .tf-drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 800; }
  .tf-drawer-head button { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--ink); }
  .tf-nav { flex-direction: column; align-items: stretch; padding: 8px 12px; }
  .tf-nav a.tf-link, .tf-nav button.tf-link { width: 100%; padding: 14px; justify-content: space-between; }
  .tf-drop { position: static; display: none; border: 0; box-shadow: none; padding: 0 0 0 12px; max-height: none; }
  .tf-nav li:hover > .tf-drop { display: none; }
  .tf-nav li.is-open > .tf-drop { display: block; }
  .tf-search { margin: 8px 20px; width: auto; }
  .tf-util .tf-util-links { display: none; }
}
@media (min-width: 981px) { .tf-panel { display: flex; align-items: center; flex: 1; gap: 16px; } }

/* ---------- Homepage ---------- */
.tf-main { padding: 36px 0 72px; }
.tf-hero { display: grid; grid-template-columns: 1.65fr 1fr; gap: 24px; margin-bottom: 48px; }
.tf-hero.is-single { grid-template-columns: 1fr; }
.tf-lead { position: relative; display: block; min-height: 480px; border-radius: 16px; overflow: hidden; background: var(--ink); color: #fff; text-decoration: none; box-shadow: var(--shadow-md); }
.tf-lead img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.tf-lead:hover img { transform: scale(1.03); }
.tf-lead::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,27,51,0) 25%, rgba(11,27,51,.92) 100%); }
.tf-lead-body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 36px; }
.tf-chip { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--accent); color: #fff; font: 700 .7rem/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; }
.tf-lead h1 { font: 700 clamp(1.7rem, 3.2vw, 2.6rem)/1.15 var(--font-display); margin: 14px 0 12px; letter-spacing: -.01em; }
.tf-lead p { margin: 0 0 12px; color: #dbe3f1; max-width: 62ch; }
.tf-meta { font-size: .82rem; color: var(--muted); display: flex; gap: 12px; align-items: center; }
.tf-lead .tf-meta { color: #b9c5db; }
.tf-stack { display: flex; flex-direction: column; gap: 16px; }
.tf-mini { display: grid; grid-template-columns: 1fr 112px; gap: 16px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s; flex: 1; }
.tf-mini:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tf-mini h3 { font: 700 1.05rem/1.3 var(--font-display); margin: 6px 0 8px; }
.tf-mini h3 a { color: var(--ink); text-decoration: none; }
.tf-mini h3 a:hover { color: var(--brand); }
.tf-mini .tf-thumb { border-radius: var(--radius-sm); overflow: hidden; background: var(--canvas); aspect-ratio: 1; }
.tf-kicker { font: 700 .72rem/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.tf-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
.tf-section-title { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; font: 800 1.35rem/1 var(--font-ui); letter-spacing: -.01em; }
.tf-section-title::before { content: ''; width: 5px; height: 24px; border-radius: 3px; background: var(--accent); }
.tf-section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.tf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.tf-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s; }
.tf-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.tf-card .tf-thumb { aspect-ratio: 16/10; background: var(--canvas); display: flex; align-items: center; justify-content: center; color: #b4bccb; }
.tf-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tf-card h3 { font: 700 1.15rem/1.3 var(--font-display); margin: 0; }
.tf-card h3 a { color: var(--ink); text-decoration: none; }
.tf-card h3 a:hover { color: var(--brand); }
.tf-card p { margin: 0; color: var(--ink-2); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tf-card .tf-meta { margin-top: auto; padding-top: 6px; }
.tf-ad { grid-column: 1 / -1; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius); background: #fff; text-align: center; min-height: 120px; }
.tf-ad small { display: block; margin-bottom: 8px; color: var(--muted); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }

.tf-aside { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 24px; }
.tf-panel-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.tf-panel-box > h2 { margin: 0; padding: 16px 20px; font: 800 .8rem/1 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.tf-panel-box > h2 span { color: var(--muted); font-weight: 600; }
.tf-rank { display: grid; grid-template-columns: 36px 1fr; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.tf-rank:last-child { border-bottom: 0; }
.tf-rank b { font: 800 1.4rem/1 var(--font-display); color: #c3cbda; }
.tf-rank a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .94rem; line-height: 1.4; }
.tf-rank a:hover { color: var(--brand); }
.tf-news { background: linear-gradient(145deg, var(--brand-dark), var(--brand)); color: #fff; padding: 26px; border-radius: var(--radius); box-shadow: var(--shadow-md); }
.tf-news h3 { font: 700 1.35rem/1.2 var(--font-display); margin: 8px 0 8px; }
.tf-news p { margin: 0 0 16px; color: #cfdcf5; font-size: .92rem; }
.tf-news input { width: 100%; height: 46px; border-radius: 10px; border: 0; padding: 0 14px; font: 500 .92rem var(--font-ui); margin-bottom: 10px; }
.tf-news button { width: 100%; height: 46px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font: 700 .92rem var(--font-ui); cursor: pointer; }
.tf-news button:hover { background: var(--accent-dark); }

.tf-pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 40px; }
.tf-pager a, .tf-pager span { min-width: 42px; height: 42px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .9rem; }
.tf-pager a:hover { border-color: var(--brand); color: var(--brand); }
.tf-pager .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.tf-pager .ellipsis { border: 0; background: none; }
.tf-alert { padding: 14px 18px; border-radius: var(--radius-sm); background: #fef3f2; border: 1px solid #fecdca; color: var(--accent-dark); margin-bottom: 24px; }

@media (max-width: 980px) {
  .tf-hero { grid-template-columns: 1fr; }
  .tf-lead { min-height: 380px; }
  .tf-layout { grid-template-columns: 1fr; }
  .tf-aside { position: static; }
}
@media (max-width: 640px) {
  .tf-wrap { padding: 0 16px; }
  .tf-grid { grid-template-columns: 1fr; }
  .tf-lead-body { padding: 22px; }
  .tf-mini { grid-template-columns: 1fr 88px; }
}

/* ---------- Footer ---------- */
.tf-footer { background: var(--ink); color: #b4c0d6; margin-top: 64px; padding: 64px 0 0; font-size: .92rem; }
.tf-foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; padding-bottom: 48px; }
.tf-footer h4 { margin: 0 0 16px; font: 700 .78rem/1 var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: #fff; }
.tf-footer p { margin: 14px 0 0; max-width: 34ch; line-height: 1.7; }
.tf-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tf-footer a { color: #b4c0d6; text-decoration: none; transition: color .15s; }
.tf-footer a:hover { color: #fff; }
.tf-footer .tf-logo { color: #fff; }
.tf-foot-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 22px 0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: .82rem; color: #8493ad; }
@media (max-width: 820px) { .tf-foot-grid { grid-template-columns: 1fr 1fr; } .tf-foot-grid > :first-child { grid-column: 1 / -1; } }

/* ---------- Legacy bridge: harmonise older pages (about, contact, blog, category, article, image view) ---------- */
body { font-family: var(--font-ui); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; color: var(--ink); }
.btn, button[type=submit], input[type=submit] { font-family: var(--font-ui); }
input[type=text], input[type=email], input[type=password], input[type=search], textarea, select { font-family: var(--font-ui); border-radius: 10px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand) !important; box-shadow: 0 0 0 4px rgba(10,61,145,.12); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media print { .tf-util, .tf-header, .tf-footer, .tf-aside, .tf-ad { display: none !important; } }

/* ---------- Article & listing pages ---------- */
.tf-article-wrap { max-width: 820px; margin: 0 auto; }
.tf-crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 18px; } .tf-crumbs a { color: var(--muted); text-decoration: none; } .tf-crumbs a:hover { color: var(--brand); }
.tf-article h1 { font: 800 clamp(2rem, 4.4vw, 3rem)/1.12 var(--font-display); letter-spacing: -.02em; margin: 14px 0 16px; }
.tf-deck { font: 400 1.25rem/1.55 var(--font-display); color: var(--ink-2); margin: 0 0 20px; }
.tf-byline { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .86rem; color: var(--muted); margin-bottom: 26px; }
.tf-byline b { color: var(--ink); }
.tf-figure { margin: 0 0 30px; } .tf-figure img { width: 100%; border-radius: 14px; display: block; max-height: 520px; object-fit: cover; }
.tf-body { font: 400 1.14rem/1.85 var(--font-display); color: #1c2a42; }
.tf-body p { margin: 0 0 1.3em; } .tf-body h2 { font: 800 1.6rem/1.25 var(--font-display); margin: 1.8em 0 .6em; } .tf-body h3 { font: 700 1.3rem/1.3 var(--font-display); margin: 1.5em 0 .5em; }
.tf-body img { max-width: 100%; height: auto; border-radius: 10px; margin: 8px 0; } .tf-body a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.tf-body blockquote { margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--accent); font-style: italic; color: var(--ink-2); }
.tf-body ul, .tf-body ol { padding-left: 1.4em; margin: 0 0 1.3em; } .tf-body table { width: 100%; border-collapse: collapse; font: 400 .95rem var(--font-ui); } .tf-body td, .tf-body th { border: 1px solid var(--line); padding: 8px 10px; }
.tf-share { display: flex; gap: 10px; align-items: center; margin: 34px 0; padding: 18px 0; border-top: 1px solid var(--line); font-weight: 700; font-size: .9rem; }
.tf-share a { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--ink); color: #fff; text-decoration: none; } .tf-share a:hover { background: var(--brand); }
.tf-related { margin-top: 56px; }
.tf-cat-head { padding: 8px 0 28px; } .tf-cat-head h1 { font: 800 2.2rem/1.1 var(--font-display); margin: 8px 0 8px; } .tf-cat-head p { color: var(--ink-2); margin: 0; max-width: 60ch; }
.tf-notfound { text-align: center; padding: 80px 0; } .tf-notfound h1 { font-size: 3rem; margin: 0 0 8px; }
.tf-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); } @media (max-width: 900px) { .tf-grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); } } @media (max-width: 640px) { .tf-grid.three { grid-template-columns: 1fr; } }
