/* ─────────────────────────────────────────────────────────────
   Forty-inspired Pelican Theme
   Palette from HTML5 UP Forty · Korean fonts: MaruBuri + NanumSquare
───────────────────────────────────────────────────────────── */

/* ── Font faces (font-display: swap to prevent invisible text during load) ── */
@font-face {
  font-family: 'MaruBuri';
  font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Regular.woff2) format('woff2');
}
@font-face {
  font-family: 'MaruBuriBold';
  font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Bold.woff2) format('woff2');
}
@font-face {
  font-family: 'MaruBuriLight';
  font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Light.woff2) format('woff2');
}
@font-face {
  font-family: 'MaruBuriSemiBold';
  font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-SemiBold.woff2) format('woff2');
}
@font-face {
  font-family: 'NanumSquare';
  font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquare/NanumSquareR.woff) format('woff');
}
@font-face {
  font-family: 'NanumSquareLight';
  font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquare/NanumSquareL.woff) format('woff');
}
@font-face {
  font-family: 'NanumSquareBold';
  font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/NanumSquare/NanumSquareB.woff) format('woff');
}

/* ── Variables ── */
:root {
  --bg:        #242943;
  --bg-alt:    #2a2f4a;
  --fg:        #ffffff;
  --fg-light:  rgba(244,244,255,0.65);
  --highlight: #9bf1ff;
  --border:    rgba(212,212,255,0.1);
  --border-bg: rgba(212,212,255,0.04);
  --accent1:   #6fc3df;
  --accent2:   #8d82c4;
  --accent3:   #ec8d81;
  --accent4:   #e7b788;
  --accent5:   #8ea9e8;
  --accent6:   #87c5a4;
  --transition: 0.2s;
  --inner-w:   65em;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

/* ── Base ── */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'NanumSquareLight', 'Apple SD Gothic Neo', sans-serif;
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 0.025em;
  line-height: 1.75;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: dotted 1px rgba(255,255,255,0.3);
  transition: color var(--transition), border-color var(--transition);
}
a:hover  { color: var(--highlight); border-bottom-color: transparent; }
a:active { color: var(--highlight); border-bottom-color: transparent; opacity: 0.75; }

strong, b { font-family: 'NanumSquareBold', sans-serif; color: var(--fg); }
em { font-style: italic; }
p { margin: 0 0 1.5em; }

h1, h2, h3, h4, h5, h6 {
  font-family: 'MaruBuri', serif;
  color: var(--fg);
  font-weight: normal;
  line-height: 1.5;
  margin: 0 0 0.75em;
}
h1 { font-family: 'MaruBuriBold', serif; font-size: 2.5em; }
h2 { font-size: 1.75em; }
h3 { font-size: 1.35em; }
h4 { font-size: 1.1em; }

h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { border-bottom: 0; }

sub { font-size: 0.8em; position: relative; top: 0.5em; }
sup { font-size: 0.8em; position: relative; top: -0.5em; }

hr {
  border: 0;
  border-bottom: 1px solid var(--border);
  margin: 2em 0;
}

blockquote {
  border-left: solid 4px var(--border);
  font-style: italic;
  margin: 0 0 1.5em 0;
  padding: 0.5em 0 0.5em 1.5em;
  color: var(--fg-light);
}

code {
  background: var(--border-bg);
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  margin: 0 0.25em;
  padding: 0.25em 0.65em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

pre {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  margin: 0 0 1.5em 0;
  overflow-x: auto;
}

pre code {
  display: block;
  line-height: 1.75;
  padding: 1em 1.5em;
  margin: 0;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── Layout ── */
#wrapper {
  padding-top: 0;
  transition: opacity 0.375s ease-out;
}
#wrapper.is-transitioning { opacity: 0; }

.inner {
  max-width: var(--inner-w);
  margin: 0 auto;
  padding: 0 2em;
}

.inner > :last-child,
.inner > :last-child > :last-child { margin-bottom: 0; }

/* ── Header ── */
#header {
  display: flex;
  align-items: center;
  background: var(--bg-alt);
  box-shadow: 0 0 0.25em rgba(0,0,0,0.2);
  cursor: default;
  font-family: 'MaruBuriLight', serif;
  height: 3.25em;
  left: 0;
  letter-spacing: 0.2em;
  position: fixed;
  text-transform: uppercase;
  top: 0;
  width: 100%;
  z-index: 10000;
  transition: background var(--transition), box-shadow var(--transition);
  padding: 0 1.5em;
}

#header.alt {
  animation: none;
  background: transparent;
  box-shadow: none;
  position: absolute;
  transition: opacity 2.5s ease 0.75s;
}

body.is-loading #header.alt { opacity: 0; }

.logo {
  border: 0;
  font-size: 0.85em;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.logo strong {
  background: var(--fg);
  color: var(--bg);
  font-family: 'MaruBuriBold', serif;
  padding: 0.15em 0.35em;
  display: inline-block;
  line-height: 1.5;
  transition: background var(--transition);
}

.logo:hover strong { background: var(--highlight); color: var(--bg); }

#header nav {
  display: flex;
  margin-left: auto;
  gap: 0;
}

#header nav a {
  border: 0;
  font-size: 0.8em;
  height: 3.25em;
  line-height: 3.25em;
  padding: 0 0.75em;
  display: block;
}

/* ── Banner ── */
#banner {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg-alt) 60%, #1e2240 100%);
  padding: 8em 0 4em;
  min-height: 50vh;
  position: relative;
  overflow: hidden;
}

#banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(111,195,223,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 50%, rgba(141,130,196,0.08) 0%, transparent 60%);
  pointer-events: none;
}

#banner.major { min-height: 60vh; }

#banner .inner {
  position: relative;
  z-index: 1;
  transition: opacity 1.5s ease, transform 0.5s ease-out, filter 0.5s ease;
}

body.is-loading #banner .inner {
  filter: blur(0.125em);
  transform: translateX(-0.5em);
  opacity: 0;
}

#banner header.major {
  width: max-content;
  max-width: 100%;
}

#banner header.major h1 {
  font-family: 'MaruBuriBold', serif;
  font-size: 3.25em;
  line-height: 1.3;
  margin-bottom: 0;
}

#banner header.major h1::after {
  content: '';
  display: block;
  width: 100%;
  height: 2px;
  background: var(--fg);
  margin: 0.325em 0 0.5em 0;
}

#banner .content p {
  color: var(--fg-light);
  font-size: 0.85em;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin: 0;
}

/* ── Tiles ── */
.tiles {
  display: flex;
  flex-wrap: wrap;
  border-top: 0 !important;
}

.tiles article {
  display: flex;
  align-items: center;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  height: 40vh;
  max-height: 40em;
  min-height: 23em;
  overflow: hidden;
  padding: 2.5em 2em;
  position: relative;
  width: 40%;
  transition: transform 0.25s ease, opacity 0.25s ease, filter 1s ease;
}

/* 3번째, 4번째 타일이 나머지 공간 채움 */
.tiles article:nth-child(4n - 1),
.tiles article:nth-child(4n - 2) {
  flex: 1 auto;
}

/* 색상 오버레이 (hover 시 fade out) */
.tiles article::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.85;
  transition: opacity 0.5s ease;
  z-index: 2;
}

/* 어두운 배경 오버레이 */
.tiles article::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(36, 41, 67, 0.4);
  z-index: 1;
}

.tiles article:hover::before { opacity: 0; }
.tiles article:hover { transform: scale(1.01); }

/* 6가지 액센트 색상 순환 */
.tiles article:nth-child(6n+1)::before  { background: var(--accent1); }
.tiles article:nth-child(6n+2)::before  { background: var(--accent2); }
.tiles article:nth-child(6n+3)::before  { background: var(--accent3); }
.tiles article:nth-child(6n+4)::before  { background: var(--accent4); }
.tiles article:nth-child(6n+5)::before  { background: var(--accent5); }
.tiles article:nth-child(6n+0)::before  { background: var(--accent6); }

.tiles article header { position: relative; z-index: 3; width: 100%; }

.tiles article h2 {
  font-family: 'MaruBuri', serif;
  font-size: 1.75em;
  margin-bottom: 0.4em;
}

.tiles article h2 a {
  border: 0;
  color: var(--fg);
  display: block;
}

.tiles article h2 a:hover { color: inherit !important; }

.tiles article .link.primary {
  border: 0;
  height: 100%;
  left: 0;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 4;
}

.tiles article.is-transitioning {
  transform: scale(0.95) !important;
  filter: blur(0.5em);
  opacity: 0;
}

.tiles article p {
  font-size: 0.78em;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
  margin: 0;
}

/* ── Main (inner pages) ── */
#main {
  background-color: var(--bg-alt);
  padding-top: 3.25em;
}

#main.alt { padding-top: 3.25em; }

#main #one { padding: 4em 0; }

#main .inner { padding: 3em 2em; }

/* Article header underline */
#main header.major {
  width: max-content;
  max-width: 100%;
}

#main header.major h1 {
  font-family: 'MaruBuriBold', serif;
  font-size: 2em;
  margin-bottom: 0;
}

#main header.major h1::after {
  content: '';
  display: block;
  width: 100%;
  height: 2px;
  background: var(--fg);
  margin: 0.325em 0 0.5em 0;
}

/* ── Article hero image ── */
.article-hero-image {
  width: 100%;
  height: 22em;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 2em;
}

/* ── Article body ── */
.article-meta {
  font-size: 0.82em;
  color: var(--fg-light);
  margin-bottom: 2em;
  letter-spacing: 0.05em;
}

.article-body {
  font-family: 'NanumSquareLight', sans-serif;
  font-size: 1rem;
  line-height: 1.95;
  border-top: 1px solid var(--border);
  padding-top: 2em;
}

.article-body p { margin-bottom: 1.2em; }

.article-body h2, .article-body h3 {
  font-family: 'MaruBuriSemiBold', serif;
  color: var(--highlight);
  margin: 2em 0 0.75em;
}

.article-body ul, .article-body ol {
  padding-left: 1.5em;
  margin-bottom: 1.2em;
}

.article-body li { margin-bottom: 0.35em; }

.article-body hr {
  border-color: var(--border);
  margin: 2.5em 0;
}

.article-body strong { color: var(--fg); }

.article-body a { color: var(--highlight); }

/* ── Tags ── */
.tag {
  display: inline-block;
  background: var(--border-bg);
  border: 1px solid var(--border);
  color: var(--fg-light);
  font-size: 0.75em;
  padding: 0.2em 0.65em;
  border-radius: 3px;
  letter-spacing: 0.03em;
  transition: background var(--transition), color var(--transition);
  text-decoration: none !important;
  border-bottom: none !important;
}

.tag:hover {
  background: var(--highlight);
  color: var(--bg) !important;
  border-color: var(--highlight);
}

.tag span { opacity: 0.6; }

/* ── Tag cloud ── */
.tag-cloud { line-height: 2.5; }

/* ── List view (archives, tag pages) ── */
.tiles-list { list-style: none; }

.list-item {
  padding: 1.5em 0;
  border-bottom: 1px solid var(--border);
}

.list-item:first-child { padding-top: 0; }

.list-item h2 {
  font-family: 'MaruBuri', serif;
  font-size: 1.1em;
  margin-bottom: 0.3em;
}

.list-item h2 a {
  border: 0;
  color: var(--fg);
}

.list-item h2 a:hover { color: var(--highlight); }

/* ── Button ── */
.button {
  display: inline-block;
  background: transparent;
  border: 0;
  box-shadow: inset 0 0 0 2px var(--fg);
  color: var(--fg) !important;
  cursor: pointer;
  font-family: 'NanumSquare', sans-serif;
  font-size: 0.8em;
  font-weight: bold;
  height: 3.5em;
  letter-spacing: 0.2em;
  line-height: 3.5em;
  padding: 0 1.75em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: box-shadow var(--transition), color var(--transition), background var(--transition);
}

.button:hover, .button:active {
  box-shadow: inset 0 0 0 2px var(--highlight);
  color: var(--highlight) !important;
}

.button.special {
  background: var(--fg);
  box-shadow: none;
  color: var(--bg) !important;
}

.button.special:hover, .button.special:active {
  background: var(--highlight);
  color: var(--bg) !important;
}

/* ── Back link ── */
.back-link { margin-top: 3em; padding-top: 2em; border-top: 1px solid var(--border); }

/* ── Pagination ── */
#pagination { padding: 2em 0 3em; }

#pagination .inner {
  display: flex;
  justify-content: center;
  align-items: center;
}

.pagination {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 1em;
}

.page-num {
  font-size: 0.85em;
  color: var(--fg-light);
}

/* ── Footer ── */
#footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 3em 0;
  text-align: center;
}

#footer .footer-links {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 1.5em;
  margin-bottom: 1em;
}

#footer .footer-links a {
  font-size: 0.85em;
  color: var(--fg-light);
  border-bottom-color: transparent;
  letter-spacing: 0.05em;
}

#footer .footer-links a:hover { color: var(--highlight); }

#footer .copyright {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 0;
  font-size: 0.8em;
  color: var(--fg-light);
  letter-spacing: 0.05em;
}

#footer .copyright li + li::before {
  content: '·';
  margin: 0 0.75em;
  opacity: 0.4;
}

/* ── Body loading state ── */
body.is-loading *, body.is-loading *::before, body.is-loading *::after {
  animation: none !important;
  transition: none !important;
}

/* ── Reveal header animation ── */
@keyframes reveal-header {
  0%   { top: -4em; opacity: 0; }
  100% { top: 0;    opacity: 1; }
}
#header.reveal { animation: reveal-header 0.35s ease; }

/* ── Responsive ── */
@media (max-width: 1280px) {
  .tiles article { height: 30vh; max-height: 30em; min-height: 20em; }
}

@media (max-width: 980px) {
  .tiles article { height: 16em; max-height: none; min-height: 0; width: 50% !important; }
  #banner header.major h1 { font-size: 2.5em; }
}

@media (max-width: 736px) {
  body { font-size: 15px; }
  .tiles article { width: 50% !important; height: 16em; padding: 1.5em; }
  .tiles article h2 { font-size: 1.5em; }
  .tiles article:nth-child(4n - 1),
  .tiles article:nth-child(4n - 2) { flex: none; }
  #banner { padding: 6em 0 3em; min-height: 40vh; }
  #banner header.major h1 { font-size: 2em; }
  h1 { font-size: 2em; }
  #main .inner { padding: 2em 1.5em; }
  .inner { padding: 0 1.5em; }
}

@media (max-width: 480px) {
  .tiles { display: block; }
  .tiles article { width: 100% !important; height: 20em; }
  #header nav a:not(:last-child) { display: none; }
}

@media (max-width: 360px) {
  body { font-size: 13px; }
}
