/*
Theme Name: ToolGuides
Theme URI: https://toolguides.org
Author: ToolGuides
Description: ToolGuides 공식 테마 — 에디토리얼 한국어 테크 블로그
Version: 1.0.0
License: Private
Text Domain: toolguides
*/

/* ToolGuides — editorial Korean tech-blog homepage */

:root {
  --bg: #FAFAF7;
  --bg-elev: #FFFFFF;
  --ink: #0F1720;
  --ink-2: #2A323C;
  --muted: #6B7280;
  --muted-2: #9AA3AE;
  --line: #E7E5DE;
  --line-2: #EFEDE7;

  --accent: oklch(0.58 0.10 195);
  --accent-2: oklch(0.92 0.04 195);
  --accent-ink: oklch(0.34 0.07 195);

  --warm: oklch(0.62 0.12 50);
  --warm-tint: oklch(0.95 0.04 65);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --shadow-sm: 0 1px 0 rgba(15,23,32,.04), 0 1px 2px rgba(15,23,32,.04);
  --shadow-md: 0 1px 0 rgba(15,23,32,.04), 0 4px 16px rgba(15,23,32,.06);

  --container: 1240px;

  --serif: "Noto Serif KR", "Iowan Old Style", Georgia, serif;
  --sans: "Noto Sans KR", "Inter", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "맑은 고딕", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.tg-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============ Header ============ */
.tg-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 247, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
}
.tg-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 28px;
}
.tg-header__rule {
  height: 1px;
  background: var(--line);
}
.tg-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tg-logo__mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
}
.tg-logo__text {
  font-size: 19px;
  letter-spacing: -0.015em;
}
.tg-logo__dot { color: var(--accent); }

.tg-nav {
  display: flex;
  align-items: center;
  gap: 26px;
  justify-content: center;
}
.tg-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  position: relative;
  padding: 6px 0;
  letter-spacing: -0.005em;
}
.tg-nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .18s ease;
  transform-origin: left;
}
.tg-nav a:hover::after { transform: scaleX(1); }
.tg-nav__more { color: var(--muted); }

.tg-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tg-iconbtn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-2);
  transition: all .15s ease;
}
.tg-iconbtn:hover { background: var(--bg-elev); border-color: var(--ink-2); }
.tg-btn {
  display: inline-flex; align-items: center;
  height: 36px; padding: 0 14px;
  border-radius: 8px;
  font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.tg-btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
}
.tg-btn--ghost:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* ============ Hero ============ */
.tg-hero {
  max-width: var(--container);
  margin: 0 auto;
  padding: 64px 28px 48px;
  text-align: center;
}
.tg-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.01em;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 24px;
}
.tg-hero__pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 oklch(0.58 0.10 195 / 0.5);
  animation: tg-pulse 2s infinite;
}
@keyframes tg-pulse {
  0% { box-shadow: 0 0 0 0 oklch(0.58 0.10 195 / 0.45); }
  70% { box-shadow: 0 0 0 8px oklch(0.58 0.10 195 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.58 0.10 195 / 0); }
}
.tg-hero__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(40px, 5.4vw, 64px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  color: var(--ink);
}
.tg-hero__accent {
  color: var(--accent-ink);
  background: linear-gradient(transparent 60%, var(--accent-2) 60%);
  padding: 0 4px;
}
.tg-hero__sub {
  color: var(--muted);
  font-size: 17px;
  max-width: 620px;
  margin: 0 auto 32px;
  text-wrap: pretty;
}
.tg-search {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 8px 8px 18px;
  box-shadow: var(--shadow-md);
  transition: border-color .15s, box-shadow .15s;
}
.tg-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px oklch(0.58 0.10 195 / 0.12), var(--shadow-md);
}
.tg-search > svg { color: var(--muted); flex: 0 0 auto; }
.tg-search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  height: 44px;
  font-size: 15.5px;
  font-family: inherit;
  color: var(--ink);
  padding: 0 12px;
}
.tg-search input::placeholder { color: var(--muted-2); }
.tg-search__btn {
  height: 44px;
  padding: 0 22px;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  transition: background .15s;
}
.tg-search__btn:hover { background: var(--accent-ink); }

.tg-hero__chips {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px; margin-top: 20px; align-items: center;
}
.tg-hero__chiplabel {
  font-size: 12.5px; color: var(--muted-2);
  margin-right: 4px;
}
.tg-chip {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  transition: all .15s;
}
.tg-chip:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* ============ Section ============ */
.tg-section {
  max-width: var(--container);
  margin: 0 auto;
  padding: 32px 28px;
}
.tg-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.tg-section__kicker {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-ink);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.tg-section__title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.tg-section__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.tg-section__link:hover { color: var(--accent-ink); }
.tg-section__link svg { transition: transform .15s; }
.tg-section__link:hover svg { transform: translateX(3px); }

/* ============ Category tag ============ */
.tg-cat {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent-ink);
  background: var(--accent-2);
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.tg-cat--xs { font-size: 10.5px; padding: 2px 6px; }

/* ============ Thumb ============ */
.tg-thumb {
  position: relative;
  width: 100%;
  border-radius: var(--r-md);
  overflow: hidden;
  background: oklch(0.96 0.02 var(--thumb-hue, 195));
  border: 1px solid var(--line);
}
.tg-thumb__stripes {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    135deg,
    oklch(0.92 0.03 var(--thumb-hue, 195)) 0 14px,
    oklch(0.96 0.02 var(--thumb-hue, 195)) 14px 28px
  );
  opacity: 0.7;
}
.tg-thumb__label {
  position: absolute;
  left: 12px; bottom: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tg-thumb__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: oklch(0.55 0.10 var(--thumb-hue, 195));
}

/* ============ Featured grid ============ */
.tg-feat {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 24px;
}
.tg-feat__card {
  background: transparent;
  display: flex; flex-direction: column; gap: 14px;
  cursor: pointer;
}
.tg-feat__card .tg-thumb {
  transition: transform .35s ease;
}
.tg-feat__card:hover .tg-thumb {
  transform: translateY(-2px);
}
.tg-feat__card.is-lead {
  grid-row: span 1;
}
.tg-feat__card.is-lead .tg-feat__title {
  font-size: 24px;
  font-family: var(--serif);
  line-height: 1.25;
}
.tg-feat__body { display: flex; flex-direction: column; gap: 8px; }
.tg-feat__meta {
  display: flex; align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.tg-feat__date { color: var(--muted); }
.tg-feat__dot { color: var(--muted-2); }
.tg-feat__read {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted);
}
.tg-feat__title {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
  text-wrap: pretty;
}
.tg-feat__card:hover .tg-feat__title {
  color: var(--accent-ink);
}
.tg-feat__excerpt {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tg-feat__author {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 2px;
}

/* ============ Categories ============ */
.tg-catgrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.tg-catcard {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 18px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: all .18s ease;
}
.tg-catcard:hover {
  border-color: var(--accent);
  background: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.tg-catcard__icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--accent-2);
  color: var(--accent-ink);
  border-radius: 8px;
}
.tg-catcard__main { display: flex; flex-direction: column; min-width: 0; }
.tg-catcard__label {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.tg-catcard__desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tg-catcard__count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ============ Main + Sidebar layout ============ */
.tg-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 32px 28px 64px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 56px;
}

/* ============ Latest list ============ */
.tg-latest {
  display: flex;
  flex-direction: column;
}
.tg-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  align-items: start;
}
.tg-row:first-child { padding-top: 0; }
.tg-row:last-child { border-bottom: 0; }
.tg-row__thumb { width: 200px; }
.tg-row__body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tg-row__meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--muted);
}
.tg-row__date, .tg-row__read {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted);
}
.tg-row__title {
  margin: 2px 0 0;
  font-weight: 700;
  font-size: 19px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: pretty;
}
.tg-row:hover .tg-row__title { color: var(--accent-ink); }
.tg-row__excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============ Sidebar ============ */
.tg-side {
  display: flex; flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 80px;
  align-self: start;
}
.tg-side__box {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
}
.tg-side__head {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  color: var(--ink);
}
.tg-side__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  flex: 1;
}
.tg-side__period {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

/* Popular */
.tg-pop { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.tg-pop__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line-2);
  align-items: start;
}
.tg-pop__item:last-child { border-bottom: 0; }
.tg-pop__rank {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--accent-ink);
  min-width: 24px;
  line-height: 1.2;
}
.tg-pop__title {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin-bottom: 6px;
}
.tg-pop__title:hover { color: var(--accent-ink); }
.tg-pop__meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--muted);
}

/* Ad */
.tg-ad {
  background: var(--bg-elev);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  padding: 14px;
}
.tg-ad__top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.tg-ad__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  background: var(--bg);
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.tg-ad__size {
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--muted-2);
}
.tg-ad__box {
  width: 100%;
  aspect-ratio: 300/250;
  background: repeating-linear-gradient(
    -45deg,
    #f5f4ef 0 10px,
    #fafaf7 10px 20px
  );
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
}
.tg-ad__placeholder {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tg-ad__sponsored {
  font-family: ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--muted);
}
.tg-ad__hint {
  font-size: 13px;
  color: var(--muted-2);
}
.tg-ad__foot {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 10px;
  text-align: center;
}
.tg-ad__foot a { text-decoration: underline; }

/* Newsletter */
.tg-news__copy {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 14px;
}
.tg-news__form {
  display: flex; flex-direction: column; gap: 8px;
}
.tg-news__form input {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  outline: 0;
  background: var(--bg);
}
.tg-news__form input:focus {
  border-color: var(--accent);
  background: #fff;
}
.tg-news__form button {
  height: 38px;
  border: 0;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  transition: background .15s;
}
.tg-news__form button:hover { background: var(--accent-ink); }
.tg-news__done {
  font-size: 13.5px;
  color: var(--accent-ink);
  background: var(--accent-2);
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}
.tg-news__note {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 10px;
  text-align: center;
}

/* ============ Inline ad rail ============ */
.tg-ad-rail {
  max-width: var(--container);
  margin: 0 auto;
  padding: 8px 28px 0;
}
.tg-ad-rail__inner {
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--bg-elev);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 96px;
  background-image: repeating-linear-gradient(
    -45deg,
    #f5f4ef 0 10px,
    #fafaf7 10px 20px
  );
}
.tg-ad-rail__left {
  display: flex; align-items: center; gap: 12px;
}
.tg-ad-rail__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.tg-ad-rail__hint {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted-2);
}
.tg-ad-rail__right {
  font-size: 11.5px;
  color: var(--muted-2);
}

/* ============ Footer ============ */
.tg-foot {
  margin-top: auto;
  background: var(--ink);
  color: oklch(0.85 0.01 220);
}
.tg-foot__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 56px 28px 32px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 56px;
}
.tg-foot__brand .tg-logo { color: #fff; }
.tg-foot__brand .tg-logo__text { font-size: 22px; }
.tg-foot__tag {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: oklch(0.72 0.01 220);
  max-width: 280px;
  line-height: 1.6;
}
.tg-foot__cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.tg-foot__cols > div {
  display: flex; flex-direction: column; gap: 8px;
}
.tg-foot__cols a {
  font-size: 13.5px;
  color: oklch(0.78 0.01 220);
  transition: color .15s;
}
.tg-foot__cols a:hover { color: #fff; }
.tg-foot__h {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: oklch(0.6 0.01 220);
  margin-bottom: 4px;
}
.tg-foot__bottom {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 28px 28px;
  border-top: 1px solid oklch(0.25 0.01 220);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: oklch(0.6 0.01 220);
}

/* ============ Featured image fix ============ */
.tg-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--r-md);
}

/* ============ Responsive ============ */
@media (max-width: 1080px) {
  .tg-feat { grid-template-columns: 1fr 1fr; }
  .tg-feat__card.is-lead { grid-column: span 2; }
  .tg-catgrid { grid-template-columns: repeat(3, 1fr); }
  .tg-main { grid-template-columns: 1fr; }
  .tg-side { position: static; flex-direction: column; }
}
@media (max-width: 760px) {
  .tg-header__inner { grid-template-columns: auto 1fr; }
  .tg-nav { display: none; }

  /* 히어로 */
  .tg-hero { padding: 40px 20px 32px; }
  .tg-hero__title {
    font-size: clamp(28px, 8vw, 40px);
    word-break: keep-all;
    overflow-wrap: break-word;
  }
  .tg-hero__sub { font-size: 15px; }

  /* 검색창 */
  .tg-search { padding: 6px 6px 6px 14px; }
  .tg-search input { font-size: 14px; height: 38px; }
  .tg-search__btn {
    height: 38px;
    padding: 0 14px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* 섹션 */
  .tg-section { padding: 24px 20px; }
  .tg-main { padding: 24px 20px; }

  /* 추천글 */
  .tg-feat { grid-template-columns: 1fr; }
  .tg-feat__card.is-lead { grid-column: span 1; }

  /* 카테고리 */
  .tg-catgrid { grid-template-columns: 1fr 1fr; }

  /* 최신글 */
  .tg-row { grid-template-columns: 120px 1fr; gap: 14px; }
  .tg-row__thumb { width: 120px; }
  .tg-row__title { font-size: 16px; }

  /* 푸터 */
  .tg-foot__inner { grid-template-columns: 1fr; gap: 32px; }
  .tg-foot__cols { grid-template-columns: 1fr 1fr; }
  .tg-foot__bottom { flex-direction: column; gap: 6px; }
}
