/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --text: rgb(55, 53, 47);
  --text-secondary: rgba(55, 53, 47, 0.65);
  --text-light: rgba(55, 53, 47, 0.4);
  --bg: #ffffff;
  --bg-gray: rgba(240, 239, 237, 1);
  --bg-hover: rgba(55, 53, 47, 0.04);
  --border: rgba(55, 53, 47, 0.09);
  --link: inherit;
  --accent-yellow: rgba(209, 156, 0, 0.282);
  --accent-green: rgba(0, 96, 38, 0.156);
  --accent-pink: rgba(183, 0, 78, 0.152);
  --accent-purple: rgba(92, 0, 163, 0.141);
  --accent-gray: rgba(28, 19, 1, 0.11);
  --accent-default: rgba(42, 28, 0, 0.07);
  --max-width: 900px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif;
}

html { -webkit-print-color-adjust: exact; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== LAYOUT ===== */
.page-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2em 1.5em 4em;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 {
  letter-spacing: -0.01em;
  line-height: 1.2;
  font-weight: 600;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.75em;
}

h1 { font-size: 1.875rem; margin-top: 1.875rem; }
h2 { font-size: 1.5rem; margin-top: 1.5rem; }
h3 { font-size: 1.25rem; margin-top: 1.25rem; }
h4 { font-size: 1rem; margin-top: 1rem; }

p { margin-top: 0.5em; margin-bottom: 0.5em; }

a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
a:hover { opacity: 0.7; }

/* ===== COLUMNS ===== */
.column-list {
  display: flex;
  justify-content: space-between;
  gap: 1em;
}

.column { flex: 1; }

@media (max-width: 680px) {
  .column-list { flex-direction: column; }
  .column { width: 100% !important; }
}

/* ===== CALLOUT ===== */
.callout {
  background: var(--bg-gray);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1em 0;
}

.callout p { margin: 0.25em 0; }

/* ===== IMAGES ===== */
figure {
  margin: 1.25em 0;
  page-break-inside: avoid;
}

figure img {
  max-width: 100%;
  border-radius: 2px;
}

figcaption {
  opacity: 0.5;
  font-size: 85%;
  margin-top: 0.5em;
}

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

.intro-avatar-figure {
  width: fit-content;
  margin-left: auto;
  margin-right: 0;
  text-align: center;
}

.intro-avatar-img {
  width: 280px;
  max-width: 100%;
}

@media (max-width: 680px) {
  .intro-avatar-figure {
    margin: 1.25em auto;
  }
}

/* ===== LISTS ===== */
ul { padding-inline-start: 1.7em; margin: 0.6em 0; }
ul > li { padding-left: 0.1em; list-style: disc; }

/* ===== TOGGLE / DETAILS ===== */
details {
  margin: 0.5em 0;
  border-radius: 4px;
}

details > summary {
  cursor: pointer;
  padding: 0.4em 0;
  font-weight: 600;
  font-size: 1.25rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4em;
  user-select: none;
}

details > summary::-webkit-details-marker { display: none; }

details > summary::before {
  content: '▶';
  font-size: 0.65em;
  transition: transform 0.2s ease;
  display: inline-block;
  flex-shrink: 0;
}

details[open] > summary::before {
  transform: rotate(90deg);
}

details .toggle-content {
  padding-left: 1.5em;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESULT BLOCK ===== */
.result-block {
  background: var(--bg-gray);
  border-radius: 10px;
  padding: 0.75em 1.25em;
  margin: 1em 0;
}

.result-block h1,
.result-block h2 {
  margin-top: 0;
  line-height: 1.4;
}

.result-block .gray-text {
  color: var(--text-secondary);
}

.result-label {
  margin: 0 0 0.35em;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* ===== TAGS ===== */
.tag {
  display: inline-block;
  padding: 0 0.5em;
  border-radius: 3px;
  font-size: 0.875rem;
  white-space: nowrap;
  margin-right: 0.3em;
}

.tag-yellow { background: var(--accent-yellow); }
.tag-green { background: var(--accent-green); }
.tag-pink { background: var(--accent-pink); }
.tag-purple { background: var(--accent-purple); }
.tag-gray { background: var(--accent-gray); }

/* ===== PROJECT CARDS GALLERY ===== */
.projects-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1em;
  max-width: 820px;
  margin: 1.5em auto;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
  opacity: 1;
}

.project-card-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  object-fit: cover;
}

.project-card-media {
  position: relative;
}

.project-card-year {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.14em 0.58em;
  border-radius: 6px;
  background: rgba(238, 238, 236, 0.92);
  color: rgba(55, 53, 47, 0.9);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
  margin-bottom: 0.35em;
}

.project-card-body {
  padding: 0.75em 1em 1em;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}

.project-card-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.project-card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ===== PROJECT PAGE ===== */
.page-cover {
  width: min(calc(100% - 3em), var(--max-width));
  height: clamp(220px, 32vh, 420px);
  margin: 0.9em auto 0;
  object-fit: cover;
  object-position: center;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.project-meta {
  display: flex;
  gap: 1em;
  align-items: center;
  margin: 1em 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ===== NAVIGATION (project pages) ===== */
.project-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.project-nav a {
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.project-nav a:hover {
  color: var(--text);
  opacity: 1;
}

/* ===== ASCII ART ===== */
.ascii-art {
  font-family: "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  white-space: pre;
  line-height: 1.18;
  letter-spacing: 0.01em;
  text-align: center;
  width: fit-content;
  max-width: 100%;
  margin: 2.6em auto 1.2em;
  padding: 0 0.25em;
  font-size: clamp(0.9rem, 1.3vw, 1.15rem);
  color: var(--text-light);
}

/* ===== HEADER BAR ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.6em 1.5em;
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header-title {
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
}

.site-header-title:hover { opacity: 0.7; }

/* ===== PAGE TRANSITIONS ===== */
.page-wrapper {
  animation: pageIn 0.4s ease;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== TASK/LABEL STYLES ===== */
.task-label {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 1.25em;
}

.task-label::before {
  content: "→ ";
  color: var(--text-secondary);
  font-weight: 500;
}

.task-label::after {
  content: ":";
}

.task-text {
  margin-top: 0.25em;
}

details.toggle-h3.task-toggle > summary {
  font-size: 1.3rem;
  font-weight: 700;
}

/* ===== LINK BLOCKS (prev/next) ===== */
.link-block {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 680px) {
  .page-title { font-size: 1.75rem; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
  .task-label { font-size: 1.15rem; }
  details.toggle-h3.task-toggle > summary { font-size: 1.15rem; }
  .projects-gallery { grid-template-columns: 1fr; }
  .page-wrapper { padding: 1.5em 1em 3em; }
  .ascii-art {
    font-size: clamp(0.62rem, 2.6vw, 0.8rem);
    line-height: 1.12;
  }
  .page-cover {
    width: calc(100% - 2em);
    height: clamp(180px, 25vh, 280px);
    margin-top: 0.6em;
    border-radius: 10px;
  }
}

/* ===== SUMMARY LARGE (for toggle headings) ===== */
details.toggle-h1 > summary { font-size: 1.875rem; }
details.toggle-h2 > summary { font-size: 1.5rem; }
details.toggle-h3 > summary { font-size: 1.25rem; }

/* ===== SUMMARY SUBITEMS (for nested "what I did" points) ===== */
details.toggle-subitem {
  margin: 0.2em 0;
}

details.toggle-subitem > summary {
  font-size: 1rem;
  font-weight: 500;
  padding: 0.25em 0;
}

details.toggle-subitem > summary::before {
  font-size: 0.55em;
  color: var(--text-secondary);
}

details.toggle-subitem .toggle-content {
  padding-left: 1.2em;
}

/* ===== THREE COLUMNS ===== */
.column-list-3 {
  display: flex;
  gap: 1em;
}

.column-list-3 .column {
  width: 33.33%;
}

@media (max-width: 680px) {
  .column-list-3 { flex-direction: column; }
  .column-list-3 .column { width: 100%; }
}

/* ===== CENTERED CTA ===== */
.cta-block {
  text-align: center;
  margin: 2em 0;
}

.cta-block a {
  font-size: 1.875rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

.cta-block a:hover { opacity: 0.6; }

/* ===== TELEGRAM GAME CTA ===== */
.gameplay-figure {
  width: min(400px, 100%);
  margin: 2em auto;
  text-align: center;
}

.gameplay-gif {
  width: 100%;
  border-radius: 8px;
}

.gameplay-cta-caption {
  margin-top: 0.55em;
  font-size: 1.875rem;
  font-weight: 600;
  opacity: 1;
}

.gameplay-cta-caption a {
  text-decoration: none;
  color: var(--text);
}

.gameplay-cta-caption a:hover {
  opacity: 0.6;
}
