:root {
  --font-family-en: helvetica-neue-world;
  --font-family-ko: 'KP CheonRiMa';
  --font-family-ja: a-otf-ud-shin-go-pr6n;
  --font-family-default: var(--font-family-en), var(--font-family-ja), var(--font-family-ko), sans-serif;
  --font-family-code: 'Red Hat Mono', 'IBM Plex Sans JP', 'KP CheonRiMa', monospace;
  --page-bg: #f8f9fa;
  --surface: #ffffff;
  --surface-soft: #f3f5f7;
  --text: #222426;
  --muted: #666f78;
  --border: #e1e5e9;
  --link: #005ea8;
  --link-hover: #003f73;
  --radius: 8px;
  --main-width: 760px;
  --nav-width: 1040px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-y: scroll;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--page-bg);
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font-family-default);
  font-size: 18px;
  line-height: 1.65;
  word-break: break-word;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

code,
pre {
  font-family: var(--font-family-code);
}

/* Adobe Fonts loading state removed to prevent text disappearing during load */

.site-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
}

.site-nav {
  max-width: calc(var(--nav-width) + 48px);
  min-height: 60px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-logo a {
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  text-decoration: none;
}

.site-menu {
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  list-style: none;
  overflow: hidden;
}

.site-menu::-webkit-scrollbar {
  display: none; /* Hide scrollbar in Chrome/Safari */
}

.site-menu a {
  display: block;
  color: var(--text);
  font-size: 16px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-menu a:hover,
.site-menu a.active {
  border-bottom-color: currentColor;
}

.site-main {
  width: 100%;
  max-width: calc(var(--main-width) + 48px);
  min-height: calc(100vh - 120px);
  margin: 0 auto;
  padding: 28px 24px 56px;
}

.site-footer {
  max-width: calc(var(--main-width) + 48px);
  margin: 0 auto;
  padding: 22px 24px 32px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-footer a {
  color: inherit;
  border-bottom: 1px solid currentColor;
}

.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0 0 8px;
  font-size: 40px;
  line-height: 1.2;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.profile-mode {
  text-align: center;
  padding: 32px 0;
  margin-bottom: 28px;
}

.profile-content {
  max-width: 800px;
  margin: 0 auto;
}

.profile-title {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.15;
}

.profile-subtitle {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 20px;
}

.profile-description {
  max-width: 680px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
  white-space: pre-line;
}

.profile-buttons {
  max-width: 620px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.profile-button {
  display: block;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.profile-button:hover {
  background-color: var(--surface-soft);
  border-color: #b6c2cd;
  color: var(--text);
  text-decoration: none;
}

.profile-button .button-title {
  display: block;
  margin-bottom: 4px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}

.profile-button .button-subtitle {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-entry {
  position: relative;
  margin-bottom: 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.post-entry:hover,
.post-entry:focus-within {
  background-color: var(--surface-soft);
  border-color: #b6c2cd;
}

.post-entry h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
}

.post-entry h2 a::before,
.content-card-container h2 a::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.post-entry .entry-content a,
.content-card-container p a,
.content-card-container > a,
.content-card-container div {
  position: relative;
  z-index: 2;
}

.post-entry h2 a,
.entry-header h2 {
  color: var(--text);
}

.entry-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.entry-link:hover {
  color: inherit;
  text-decoration: none;
}

.entry-content {
  margin: 10px 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.entry-content p {
  margin: 0;
}

.entry-footer,
.post-meta {
  color: var(--muted);
  font-size: 13px;
}

.entry-link:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.post-single {
  background: transparent;
}

.post-header {
  margin-bottom: 28px;
}

.post-title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 40px;
  line-height: 1.25;
}

.post-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 16px;
}

.post-description p {
  margin: 0;
}

.post-content {
  color: var(--text);
  line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 2rem 0 1rem;
  line-height: 1.35;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content table,
.post-content blockquote,
.post-content pre {
  margin: 0 0 1.25rem;
}

.post-content ul,
.post-content ol {
  padding-left: 1.5rem;
}

.post-content table {
  display: block;
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
}

.post-content th,
.post-content td {
  white-space: pre-line;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
}

.post-content th {
  background: var(--surface-soft);
  font-weight: 600;
}

.post-content img {
  margin: 1.5rem auto;
  border-radius: 4px;
}

.post-tags,
.terms-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.post-tags a,
.terms-tags a {
  display: inline-block;
  padding: 4px 11px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}

.content-card-container {
  position: relative;
  margin: 32px 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.content-card-container:hover,
.content-card-container:focus-within {
  background-color: var(--surface-soft);
  border-color: #b6c2cd;
}

.content-card-container h2,
.content-card-container p {
  margin-top: 0;
}

.content-card-container p:last-child {
  margin-bottom: 0;
}

.home-site-image img {
  margin: 16px auto;
}

.home-copyright-notice {
  text-align: center;
}

.form-group {
  margin-bottom: 1rem;
}

.form-control,
select,
textarea,
input[type='text'],
input[type='email'],
input[type='password'],
input[type='date'] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

textarea.form-control {
  min-height: 9rem;
}

.btn,
button {
  border: 1px solid var(--border);
  border-radius: 6px;
}

.btn,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  color: #fff;
  background: var(--link);
  cursor: pointer;
}

.btn-secondary {
  color: var(--text);
  background: var(--surface-soft);
}

.button-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.copy-text-container button,
.x-share-container a,
.screenshot-container button {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .site-nav {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 20px;
    gap: 8px;
  }

  .site-menu {
    width: 100%;
    gap: 18px;
  }

  .site-main {
    padding: 24px 20px 48px;
  }

  .profile-title,
  .post-title,
  .page-header h1 {
    font-size: 32px;
  }

  .profile-buttons {
    grid-template-columns: 1fr;
  }

  .post-entry,
  .content-card-container {
    padding: 18px;
  }
}

/* Custom Directives */
.image-gallery-wrapper {
  position: relative;
  margin: 1.5rem 0;
  border-radius: 4px;
  border: 1px solid var(--border);
  overflow: visible;
}

.image-gallery-wrapper img {
  border-radius: 3px 3px 0 0;
}

.image-gallery-wrapper img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  cursor: pointer;
}

.image-caption {
  padding: 0.75rem 1rem;
  background: var(--surface-soft);
  font-size: 0.875rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}

figcaption.image-annotation {
  display: block;
  margin: 0.25rem 0 1.5rem;
  padding-left: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #6b7280;
  font-style: normal;
}

.image-caption-counter {
  color: var(--muted);
  font-weight: 500;
}

.gallery-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.gallery-nav button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.gallery-nav button:hover {
  background: var(--surface-soft);
  border-color: var(--muted);
}
