/* ================================================
   Physical Design Interview Guide — Hugo Theme
   Ported from Blogger Nordic theme
   ================================================ */

/* ---------- CSS Variables (light mode) ---------- */
:root {
  --bg:           #ffffff;
  --text:         #000000;
  --surface:      #ffffff;
  --surface-2:    #bdbdbd;
  --border:       #000000;
  --link:         #000000;
  --link-hover:   #4139bd;
  --link-visited: #555555;
  --input-bg:     #ffffff;
  --input-text:   #111111;
  --accent:       #1a56cc;
  --on-accent:    #ffffff;
  --highlight-bg: #fff9c0;
  --surface-hover:#e5e7eb;
  --teal:         #07948B;
}

/* ---------- Dark mode ---------- */
html[data-theme="dark"] {
  --bg:           #000000;
  --text:         #e5e7eb;
  --surface:      #000000;
  --surface-2:    #555555;
  --border:       #e5e7eb;
  --link:         #22d3ee;
  --link-visited: #9ca3af;
  --link-hover:   #67e8f9;
  --input-bg:     #111827;
  --input-text:   #e5e7eb;
  --accent:       #1a56cc;
  --on-accent:    #ffffff;
  --highlight-bg: #4b3f0a;
  --surface-hover:#1f2937;
}


/* Override Font Awesome CDN font with self-hosted file — faster, no external font request */
@font-face {
  font-family: 'FontAwesome';
  src: url('/fonts/fontawesome-webfont.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'Amatic SC';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('/fonts/amatic-sc-v28-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Amatic SC';
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url('/fonts/amatic-sc-v28-latin-700.woff2') format('woff2');
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-family: sans-serif; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden;
       font-family: 'Dosis', serif; font-weight: 500; font-size: 1rem; line-height: 1.5; }
article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary { display: block; }
img  { border: 0; height: auto; max-width: 100%; }
table { border-collapse: collapse; border-spacing: 0; margin: 1.5em 0; width: 100%; overflow-x: auto; display: block; }
.entry-content table { display: table; }
th, td { padding: 10px 14px; text-align: left; border: 1px solid var(--border); font-size: 0.95rem; }
th { background: var(--surface-2); font-weight: 600; color: var(--text); }
tr:nth-child(even) td { background: var(--surface); }
tr:hover td { background: var(--surface-2); }
@media (max-width: 640px) { table { display: block; overflow-x: auto; white-space: nowrap; } }
hr   { background-color: var(--border); border: 0; height: 1px; margin-bottom: 1.5em; }
pre  { overflow: auto; background: var(--surface-2); font-family: "Courier 10 Pitch", Courier, monospace;
       font-size: .9375rem; line-height: 1.6; margin-bottom: 1.6em; max-width: 100%; padding: 1.6em; }
code,kbd,tt,var { font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace; font-size: .9375rem; }
mark,ins { background: var(--highlight-bg); text-decoration: none; }
blockquote { padding: 1em 1.5em; margin-bottom: 1em; font-style: italic;
             border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
ul,ol { margin: 0 0 1.5em 3em; }
ul { list-style: disc; }
ol { list-style: decimal; }
p  { margin-bottom: 1.5em; }

/* ---------- Typography ---------- */
h1,h2,h3,h4,h5,h6 {
  clear: right; font-weight: 700;
  font-family: 'Amatic SC', sans-serif;
  color: var(--text); word-break: break-word;
}
h1 { font-size: 4rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 2rem; }
h4 { font-size: 1.75rem; }
h5 { font-size: 1.625rem; }
h6 { font-size: 1.4375rem; }

/* ---------- Links ---------- */
a { text-decoration: none; color: var(--link); }
a:visited { color: var(--link-visited); }
a:hover, a:focus, a:active { text-decoration: underline; color: var(--link-hover); }

/* ================================================
   HEADER
   ================================================ */
.site-header { width: 100%; background: var(--surface); }

.site-branding {
  text-align: center;
  max-width: 1000px;
  margin: 0 auto;
  padding: 30px 25px 10px;
}
#header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
}
.logo-link {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
}
.header-logo {
  height: auto; max-height: 80px; width: auto; max-width: 100%;
  object-fit: contain; display: block;
}
.titlewrapper { text-align: center; }
.site-title {
  margin: 0; font-size: 3.5rem; font-weight: bold;
  line-height: 1.2; font-family: 'Amatic SC', sans-serif;
}
.site-title a { color: var(--text); text-decoration: none; }
.site-description { margin: 5px 0 0; font-size: 1.5rem; color: var(--text); font-family: 'Amatic SC', sans-serif; }

@media (max-width: 870px) {
  #header-inner { flex-direction: column; }
  .logo-link { position: static; transform: none; margin-bottom: 10px; }
  .header-logo { max-height: 60px; }
}

/* ================================================
   NAVIGATION — border wraps ONLY around the pill row
   ================================================ */
.main-navigation {
  width: 100%;
  background: var(--surface);
  padding: 0;
}

/* This inner wrapper is what gets the border — 
   it only spans as wide as its content (pills + buttons) */
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  /* Constrain to content width so borders don't span full page */
  width: fit-content;
  margin: 0 auto;
  /*border-top: 3px solid var(--border); */
  border-bottom: 3px solid var(--border); 
  padding: 6px 8px;
  gap: 6px;
}

/* Tab pills */
.nav-inner ul {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 6px;
  justify-content: center;
}
.nav-inner ul li { margin: 0; }
.nav-inner ul li a {
  display: inline-block;
  padding: 8px 12px;
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap;
  font-family: 'Dosis', sans-serif;
  font-size: 1rem;
  text-transform: uppercase;
}
.nav-inner ul li a:hover  { background: var(--surface-hover); text-decoration: none; }
.nav-inner ul li a.active,
.nav-inner ul li.current > a { background: var(--accent); color: var(--on-accent); }

/* Toggle and search sit inside ul but have no pill background */
.nav-inner ul li.nav-btn-item { display: flex; align-items: center; }
.nav-inner ul li.nav-btn-item button { background: transparent; border: none; cursor: pointer;
  font-size: 18px; color: var(--text); padding: 4px 6px; display: flex; align-items: center; }

/* Dark/light toggle — sits right after the pills inside the border */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  flex: 0 0 auto;
  color: var(--text);
  padding: 0;
}
html[data-theme="dark"]       .theme-toggle .sun  { display: none; }
html:not([data-theme="dark"]) .theme-toggle .moon { display: none; }

/* Search toggle — also inside the border */
.search-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 0 4px;
  color: var(--text);
  font-size: 18px;
  flex: 0 0 auto;
  background: transparent;
  border: none;
}

/* Search box drops below nav */
.search-box-wrapper {
  display: none;
  width: 100%;
  padding: 8px 25px;
  background: var(--surface);
  border-bottom: 3px solid var(--border);
}
.search-box-wrapper.open { display: flex; align-items: center; gap: 8px; }
.search-box-wrapper form { display: flex; width: 100%; max-width: 600px; margin: 0 auto; gap: 8px; }
.search-box-wrapper input[type="search"] {
  flex: 1;
  padding: 8px 12px;
  font-size: 1rem;
  font-family: 'Dosis', sans-serif;
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.search-box-wrapper button[type="submit"] {
  padding: 8px 16px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Dosis', sans-serif;
}
.search-box-wrapper button[type="submit"]:hover { background: var(--surface-hover); }

/* Hamburger — mobile only */
.menu-toggle {
  display: none;
  cursor: pointer;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text);
  padding: 0.5rem 1rem;
}

@media screen and (max-width: 700px) {
  .menu-toggle { display: block; }
  .nav-inner { width: 100%; border-left: none; border-right: none; }
  .nav-inner ul { display: none; width: 100%; flex-direction: column; }
  .main-navigation.toggled .nav-inner ul { display: flex; }
  .nav-inner ul li a { display: block; width: 100%; border-radius: 0; }
}

/* ---- Ad strip ---- */
.header-ad-wrapper { text-align: center; margin: 20px auto 30px; width: 100%; clear: both; }

/* ================================================
   TWO-COLUMN LAYOUT
   ================================================ */
.site-content { width: 100%; }
.content-area {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;  /* sidebar height = its own content, not stretched to match main */
  margin-left: 25px;
  margin-right: 25px;
  background: var(--surface);
}

/* Left sidebar */
.sidebar {
  width: 280px;
  margin-right: 25px;
  box-sizing: border-box;
  flex-shrink: 0;
  overflow: hidden;
}
/* Force ad iframes to not exceed sidebar width — but don't affect height */
.sidebar .widget iframe,
.sidebar .widget ins {
  max-width: 100% !important;
  width: auto !important;
}
.sidebar .widget {
  border: 3px solid var(--border);
  margin-bottom: 15px;
  padding: 10px;
  box-sizing: border-box;
}
.sidebar .widget h2 {
  font-size: 1.875rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1em;
}

/* Dynamic posts widget — constrain the whole widget box, list scrolls inside */
#dynamic-posts-list-container {
  max-height: 90vh;    /* desktop: ~65% of screen height, scrollable */
  display: flex;
  flex-direction: column;
}
/* The ul scrolls inside the fixed-height widget */
#dynamic-posts-list {
  overflow-y: auto;
  padding: 0;
  margin: 0;
  flex: 1;
  min-height: 60px;
}
@media screen and (max-width: 960px) {
  #dynamic-posts-list-container {
    max-height: 220px; /* mobile: 3-4 posts */
  }
}
#dynamic-posts-list li { padding: 4px 0; list-style: none; margin: 0; padding-left: 0; }
#dynamic-posts-list li a         { color: var(--link); }
#dynamic-posts-list li a:visited { color: var(--link-visited); }
#dynamic-posts-list li a:hover   { color: var(--link-hover); text-decoration: underline; }

@media screen and (max-width: 960px) {
  .content-area { display: block; margin-left: 5px; margin-right: 5px; }
  .sidebar { width: 100%; margin-right: 0; margin-bottom: 25px; }
}

/* Main column */
.site-main {
  width: calc(100% - 305px);
  max-width: none;
  margin: 0;
  background: var(--surface);
}
@media screen and (max-width: 960px) {
  .site-main { width: 100%; }
}

/* ================================================
   POST CARDS
   ================================================ */
.post-outer { margin-bottom: 0; }
.post.hentry {
  border: 3px solid var(--border);
  padding: 0 2rem;
  margin-bottom: 1.5em;
  background: var(--surface);
}
@media screen and (max-width: 600px) {
  .post.hentry { padding: 5px; }
}

.post-date { font-family: 'Dosis', sans-serif; font-size: 0.875rem; color: var(--text); margin-bottom: 0.5em; }

.entry-title { margin: 0 0 1.5rem; font-size: 2.5rem; line-height: 1.3em; color: var(--text); }
.entry-title a { color: var(--text); }
.entry-title a:hover { color: var(--teal); text-decoration: none; }

@media screen and (max-width: 680px) { .entry-title { font-size: 2.2rem; } }

.entry-meta { margin-bottom: 2rem; padding: 0; font-family: 'Dosis', sans-serif; font-size: 1rem; }
.entry-meta a { font-weight: 700; }

.entry-content { margin: 1.5em 0 0; }
.entry-content a { text-decoration: underline; }
.entry-content p, .entry-content ul, .entry-content ol { font-size: 1.125rem; line-height: 1.6em; }
.entry-content blockquote p { font-size: 1.5rem; }
.entry-content h1 { font-size: 4rem; }
.entry-content h2 { font-size: 2.5rem; }
.entry-content h3 { font-size: 2rem; }
.entry-content h4 { font-size: 1.75rem; }

@media screen and (max-width: 680px) {
  .entry-content h1 { font-size: 2.7rem; }
  .entry-content h2 { font-size: 2.6rem; }
  .entry-content h3 { font-size: 2.4rem; }
  .entry-content p, .entry-content ul, .entry-content ol { font-size: 1rem; }
}

/* Share + Read More */
.post-share { overflow: hidden; padding: 15px 0 5px; float: left; }
.post-share a { padding: 0 5px; color: var(--text); }
.post-share a:hover { color: var(--teal); }
.read-more { display: inline-block; float: right; margin-top: 15px; font-weight: 700; font-size: 1rem; color: var(--link); }
.read-more:hover { color: var(--teal); text-decoration: underline; }
.sr-only { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Pagination */
.blog-pager { text-align: center; padding: 5px; margin: 10px 0 20px; }
.blog-pager a { display: inline-block; padding: 8px 20px; background: var(--surface-2); color: var(--text); border-radius: 3px; margin: 0 5px; text-decoration: none; font-family: 'Dosis', sans-serif; }
.blog-pager a:hover { background: var(--surface-hover); }
.blog-pager-newer-link { float: left; }
.blog-pager-older-link { float: right; }

/* Post prev/home/next navigation — 3 equal columns, home always centered */
.post-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: 20px 0;
  padding: 5px 0;
}
.post-nav-prev { text-align: left; }
.post-nav-home { text-align: center; }
.post-nav-next { text-align: right; }
.post-nav a {
  display: inline-block;
  padding: 8px 14px;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 3px;
  font-family: 'Dosis', sans-serif;
  font-size: 0.9rem;
  text-decoration: none;
  max-width: 220px;          /* truncate long titles */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.post-nav a:hover { background: var(--surface-hover); text-decoration: none; }
.post-nav-home a { max-width: none; font-weight: 700; }
@media screen and (max-width: 600px) {
  .post-nav { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .post-nav-prev, .post-nav-home, .post-nav-next { text-align: center; }
  .post-nav a { max-width: 100%; }
}

/* Copy link button in share bar */
.copy-link-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 16px;
  padding: 0 5px;
  vertical-align: middle;
}
.copy-link-btn:hover { color: var(--teal); }

/* Comments */
#comments { padding: 2rem; margin-bottom: 20px; border: 3px solid var(--border); }
#comments h4 { font-size: 1.375rem; margin-bottom: 10px; }

/* ================================================
   SEARCH PAGE
   ================================================ */
.search-results { padding: 1rem 0; }
.search-results h1 { font-family: 'Amatic SC', sans-serif; font-size: 2.5rem; margin-bottom: 1rem; }
.search-result-item { border: 3px solid var(--border); padding: 1rem 2rem; margin-bottom: 1.5em; }
.search-result-item h2 { font-size: 2rem; margin-bottom: 0.5rem; }
.search-result-item h2 a { color: var(--text); }
.search-result-item h2 a:hover { color: var(--teal); }
.search-result-item .meta { font-family: 'Dosis', sans-serif; font-size: 0.875rem; margin-bottom: 0.5rem; }
.search-box-page { margin-bottom: 2rem; }
.search-box-page form { display: flex; gap: 8px; max-width: 500px; }
.search-box-page input { flex: 1; padding: 8px 12px; font-family: 'Dosis', sans-serif; border: 1px solid var(--border); background: var(--input-bg); color: var(--input-text); border-radius: 3px; }
.search-box-page button { padding: 8px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 3px; cursor: pointer; font-family: 'Dosis', sans-serif; }

/* ================================================
   FOOTER
   ================================================ */
.site-footer { clear: both; width: 100%; padding: 2em; font-size: 0.875rem; color: var(--text); background: var(--surface); }
#supplementary { background-color: var(--surface); border: 3px solid var(--border); }
.footer-widgets { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; padding: 20px; }
.footer-widgets .widget { min-width: 250px; padding: 25px; }
.footer-widgets .widget h2 { font-size: 1.875rem; border-bottom: 2px solid var(--border); margin-bottom: 1em; }
.popular-posts ul { list-style: none; margin: 0; padding: 0; }
.popular-posts li { padding: 6px 0; border-bottom: 1px solid var(--surface-2); }
.popular-posts li a { font-weight: 700; color: var(--text); }
.site-info { text-align: center; padding: 20px 0; border-bottom: 3px solid var(--border); }
.site-info a { color: var(--text); }
.site-info a:hover { color: var(--teal); }

@media screen and (max-width: 879px) { .footer-widgets .widget { width: 100%; } }

/* Footer forms */
.footer-form-widget { min-width: 260px; max-width: 340px; }
.footer-form-row { margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.footer-form-row label { font-family: "Dosis", sans-serif; font-size: 0.9rem; font-weight: 700; }
.footer-form-row input[type="text"],
.footer-form-row input[type="email"],
.footer-form-row textarea {
  width: 100%;
  padding: 8px 10px;
  font-family: "Dosis", sans-serif;
  font-size: 0.95rem;
  background: var(--input-bg);
  color: var(--input-text);
  border: 2px solid var(--border);
  border-radius: 3px;
  box-sizing: border-box;
}
.footer-form-row textarea { resize: vertical; }
.footer-btn {
  padding: 8px 20px;
  background: var(--surface-2);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  font-family: "Dosis", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  width: 100%;
}
.footer-btn:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* Disable text selection */
body { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
.entry-content { -webkit-user-select: text; -moz-user-select: text; -ms-user-select: text; user-select: text; }

/* Breadcrumb */
.breadcrumb {
  font-family: "Dosis", sans-serif;
  font-size: 0.875rem;
  padding: 8px 2rem;
  color: var(--text);
  border-bottom: 1px solid var(--surface-2);
  margin-bottom: 0;
}
.breadcrumb a { color: var(--link); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--link-visited); }

/* Category page title */
.category-page-title { font-family: 'Amatic SC', sans-serif; font-size: 2.5rem; padding: 1rem 0 0.5rem; border-bottom: 3px solid var(--border); margin-bottom: 1.5rem; }

/* 404 */
.error-404 { padding: 2rem; max-width: 700px; }
.error-404 h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.error-search { margin: 1.5rem 0; display: flex; gap: 8px; max-width: 500px; }
.error-search input { flex: 1; padding: 10px 14px; font-family: "Dosis", sans-serif;
  font-size: 1rem; border: 2px solid var(--border); background: var(--input-bg);
  color: var(--input-text); border-radius: 3px; }
.error-search button { padding: 10px 20px; background: var(--surface-2);
  border: 2px solid var(--border); border-radius: 3px; cursor: pointer;
  font-family: "Dosis", sans-serif; font-size: 1rem; }
.error-search button:hover { background: var(--surface-hover); }
.error-links { margin: 1.5rem 0; }
.error-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.75rem; }
.error-categories a { padding: 6px 12px; background: var(--surface-2);
  border-radius: 4px; color: var(--text); font-family: "Dosis", sans-serif;
  text-transform: uppercase; font-size: 0.9rem; }
.error-categories a:hover { background: var(--accent); color: var(--on-accent);
  text-decoration: none; }

/* date-header hidden */
h2.date-header { display: none; }

/* Disable text selection and copy on post content */
.entry-content {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Post images via {{< img >}} shortcode */
.post-image { margin: 1.5rem 0; text-align: center; }
.post-image img { max-width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.post-image figcaption { font-size: 0.85rem; color: var(--text-muted); margin-top: 6px; font-style: italic; }

/* Blogger image links — add aria-label via attr, hide decorative separators */
.post-body .separator a:not([aria-label]) { display: block; }
.post-body .separator img { max-width: 100%; height: auto; }

/* Fix ad iframe accessibility — add title after Adsterra injects iframes */
/* Done via JS in main.js */

/* ---- Ad slot visibility ---- */
.ad-header-desktop { display: block; }   /* 728x90 header — desktop only */
.ad-desktop-post   { display: block; }   /* native banner below post — desktop only */
.ad-mobile-post    { display: none;  }   /* 300x250 below post — mobile only */

@media screen and (max-width: 768px) {
  .ad-header-desktop { display: none;  }
  .ad-desktop-post   { display: none;  }
  .ad-mobile-post    { display: block; }
}

/* ================================================
   ABOUT & PRIVACY PAGES
   ================================================ */
.about-page h2, .privacy-page h2 {
  font-size: 2rem;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.25em;
}
.about-page h3, .privacy-page h3 {
  font-size: 1.5rem;
  margin-top: 1.2em;
}
.about-page p, .privacy-page p,
.about-page li, .privacy-page li {
  font-size: 1.1rem;
  line-height: 1.7;
}
.about-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 1em 0;
}
.about-topics li a {
  display: inline-block;
  padding: 6px 14px;
  background: var(--surface-2);
  border-radius: 4px;
  font-family: "Dosis", sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
}
.about-topics li a:hover {
  background: var(--accent);
  color: var(--on-accent);
}