/* Academicpages-inspired restyle
   Palette and structure loosely based on academicpages.github.io (Minimal Mistakes "air" skin).
*/

:root {
  --text: #3f3f3f;
  --muted: #898c8f;
  --link: #52adc8;
  --link-hover: #2d7893;
  --border: #f2f3f3;
  --border-strong: #e8e8e8;
  --bg: #ffffff;
  --bg-muted: #fafafa;
  --code-bg: #f6f8fa;
  --content-max: 1200px;
  --sidebar-width: 240px;
  --gutter: 2rem;
  --font-sans: "PT Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: Menlo, Consolas, Monaco, "Liberation Mono", "Lucida Console", monospace;
}

/* Reset minima defaults that fight the new layout */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  margin: 0;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color .15s ease;
}
a:hover { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.25;
  margin: 1.4em 0 .5em;
  border: none;
  padding: 0;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.45rem; padding-bottom: .25em; border-bottom: 1px solid var(--border); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }

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

img { max-width: 100%; height: auto; border-radius: 0; animation: none; }

blockquote {
  border-left: 4px solid var(--border-strong);
  background: var(--bg-muted);
  padding: .6em 1em;
  margin: 1.25em 0;
  color: #555;
  font-style: italic;
  border-radius: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 3px;
}
pre {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 1em;
  border-left: 3px solid var(--border-strong);
  border-radius: 3px;
  overflow-x: auto;
  font-size: 0.88em;
}
pre code { background: none; padding: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25em 0;
  background: var(--bg);
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
}
th, td {
  padding: .5em .75em;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { background: var(--bg-muted); font-weight: 700; }
tr:hover { background: transparent; }

/* ===== Masthead (top nav) ===== */
.site-header {
  background: var(--bg);
  border-top: none;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  min-height: auto;
  padding: 0;
}
.site-header .wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  flex-wrap: wrap;
}
.site-title, .site-title:visited {
  color: var(--text) !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  letter-spacing: .01em;
  line-height: 60px;
  padding: 0;
  margin: 0;
  float: none;
  border: none;
}
.site-title:hover { color: var(--link); text-decoration: none; }

.site-nav {
  float: none;
  background: none;
  border: none;
  position: static;
  line-height: 60px;
}
.site-nav .trigger {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}
.site-nav .page-link {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.95rem;
  margin-left: 1.25rem;
  line-height: 60px;
  padding: 0;
  display: inline-block;
  border: none;
}
.site-nav .page-link:hover { color: var(--link); text-decoration: none; }
.site-nav .page-link::after { display: none; }

.lang-toggle {
  border: 1px solid var(--border-strong) !important;
  border-radius: 2px !important;
  padding: 4px 10px !important;
  margin-left: 1.25rem !important;
  font-weight: 700 !important;
  font-size: 0.8rem !important;
  line-height: 1 !important;
  color: var(--muted) !important;
}
.lang-toggle:hover { color: var(--link) !important; border-color: var(--link) !important; }

/* Hide mobile-only menu toggle on desktop */
.site-nav .nav-trigger,
.site-nav label[for="nav-trigger"] { display: none; }

/* ===== Main layout: sidebar + content ===== */
.page-content { padding: 0; animation: none; }
.page-content .wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}

.site-layout {
  display: flex;
  gap: var(--gutter);
  align-items: flex-start;
}

/* Sidebar with avatar and author meta */
.author-sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  position: sticky;
  top: 2rem;
}
.author-sidebar__avatar {
  display: block;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
}
.author-sidebar__name {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 .15em;
  color: var(--text);
}
.author-sidebar__bio {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 1rem;
}
.author-sidebar__links {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
}
.author-sidebar__links li {
  padding: 4px 0;
  color: var(--muted);
}
.author-sidebar__links li a {
  color: var(--muted);
  display: inline-block;
}
.author-sidebar__links li a:hover { color: var(--link); text-decoration: none; }
.author-sidebar__links .icon {
  display: inline-block;
  width: 1.2em;
  margin-right: .5em;
  text-align: center;
  color: var(--muted);
}

/* Main content column */
.site-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100% - var(--sidebar-width) - var(--gutter));
}
.site-main .post { margin: 0; }
.site-main .post-header { margin-bottom: 1.5em; border: none; padding: 0; }
.site-main .post-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 .25em;
  line-height: 1.2;
  border: none;
}
.site-main .post-meta {
  color: var(--muted);
  font-size: 0.88rem;
}
.site-main .post-content { font-size: 1rem; }

/* ===== Homepage intro + post list ===== */
.home-intro {
  padding: 0 0 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.home-intro h1 {
  font-size: 2rem;
  margin: 0 0 .25em;
}
.home-intro p {
  font-size: 1.02rem;
  color: #4a4a4a;
  margin: 0 0 .5em;
}
.home-intro .intro-links a {
  display: inline-block;
  margin-right: 1rem;
  font-size: 0.95rem;
}

.home-posts h2 { margin-top: 0; }
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.post-list > li {
  margin: 0 0 1.5rem;
  padding: 1rem 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  transition: none;
  transform: none;
}
.post-list > li:last-child { border-bottom: none; }
.post-list > li:hover {
  background: none;
  box-shadow: none;
  transform: none;
}
.post-link {
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  margin: 0 !important;
}
.post-link a { color: var(--text); }
.post-link a:hover { color: var(--link); text-decoration: none; }

/* ===== Buttons ===== */
.btn, button, input[type="submit"] {
  display: inline-block;
  background: var(--bg);
  color: var(--link) !important;
  padding: .4em 1em;
  border-radius: 2px;
  border: 1px solid var(--link);
  font-weight: 400;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: none;
}
.btn:hover, button:hover, input[type="submit"]:hover {
  background: var(--link);
  color: var(--bg) !important;
  transform: none;
  box-shadow: none;
  text-decoration: none;
}

/* Legacy tags/badges kept minimal */
.tag, .label {
  display: inline-block;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 0.8em;
  margin: 2px;
  font-weight: 400;
}
.badge-active, .badge-expired {
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 0.8em;
  font-weight: 600;
}
.badge-active { background: #e8f5e9; color: #2d7d3a; }
.badge-expired { background: var(--bg-muted); color: var(--muted); }

/* Content cards -> flatten */
.content-card {
  background: var(--bg);
  padding: 1rem 0;
  border-radius: 0;
  box-shadow: none;
  margin: 1rem 0;
  border-bottom: 1px solid var(--border);
  transition: none;
}
.content-card:hover { transform: none; box-shadow: none; }

/* Highlight and message boxes, neutralized */
.highlight-box {
  background: var(--bg-muted);
  border-left: 3px solid var(--link);
  padding: 1em;
  border-radius: 0;
  margin: 1.25em 0;
}
.message-success, .message-info, .message-warning {
  padding: .75em 1em;
  border-radius: 0;
  margin: 1em 0;
  border-left: 3px solid var(--border-strong);
  background: var(--bg-muted);
}
.message-success { border-left-color: #48bb78; }
.message-info    { border-left-color: #4299e1; }
.message-warning { border-left-color: #ed8936; }

/* Kill legacy hero-section styling on home page (superseded by .home-intro) */
.hero-section {
  background: none !important;
  color: inherit !important;
  padding: 0 !important;
  border-radius: 0 !important;
  animation: none;
  box-shadow: none;
  text-align: left !important;
  margin-bottom: 1.5rem !important;
}
.hero-section h1 {
  color: var(--text) !important;
  font-size: 2rem !important;
  margin: 0 0 .25em !important;
  border: none !important;
  font-weight: 700 !important;
}
.hero-section p {
  color: #4a4a4a !important;
  opacity: 1 !important;
  font-size: 1.02rem !important;
  font-weight: 400 !important;
  max-width: none !important;
  margin: 0 0 .5em !important;
  text-align: left !important;
}
.hero-section > div { margin-top: 1rem !important; text-align: left !important; }
.hero-section a {
  display: inline-block !important;
  background: var(--bg) !important;
  color: var(--link) !important;
  border: 1px solid var(--link) !important;
  padding: .4em 1em !important;
  margin: 0 .5rem .5rem 0 !important;
  border-radius: 2px !important;
  font-weight: 400 !important;
  transition: all .15s ease !important;
  box-shadow: none !important;
}
.hero-section a:hover {
  background: var(--link) !important;
  color: var(--bg) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--bg);
  color: var(--muted);
  padding: 1.5rem 0;
  margin-top: 3rem;
  border-top: 1px solid var(--border);
}
.site-footer .wrapper {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--link); text-decoration: none; }
.site-footer .footer-col-wrapper {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--muted);
}
.site-footer .footer-col { flex: 1 1 200px; min-width: 0; }
.site-footer .contact-list { list-style: none; margin: 0; padding: 0; }
.site-footer p { margin: 0; }

/* ===== Accessibility ===== */
:focus { outline: 2px solid var(--link); outline-offset: 2px; }

/* ===== Mobile ===== */
@media screen and (max-width: 900px) {
  .site-layout { flex-direction: column; }
  .author-sidebar {
    width: 100%;
    flex: 0 0 auto;
    position: static;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
  }
  .author-sidebar__avatar {
    width: 80px;
    height: 80px;
    margin: 0;
    flex: 0 0 80px;
  }
  .author-sidebar__meta { flex: 1 1 auto; min-width: 0; }
  .site-main { max-width: 100%; }
}

@media screen and (max-width: 600px) {
  .site-header .wrapper { padding: 0 1rem; min-height: 52px; flex-direction: column; align-items: flex-start; padding-top: .5rem; padding-bottom: .5rem; }
  .site-title { line-height: 1.4 !important; }
  .site-nav { line-height: 1.5; width: 100%; }
  .site-nav .trigger { justify-content: flex-start; }
  .site-nav .page-link { margin-left: 0; margin-right: 1rem; line-height: 2; font-size: .9rem; }
  .lang-toggle { margin-left: 0 !important; margin-right: .75rem !important; }
  .page-content .wrapper { padding: 1.5rem 1rem; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }
}

/* Print */
@media print {
  .site-header, .site-footer, .author-sidebar, .hero-section { display: none; }
  .site-main { max-width: 100%; }
  body { font-size: 12pt; color: #000; }
  a { color: #000; text-decoration: underline; }
}
