/* style.css
   Designed for: WilliamShelton personal homepage (index.html)
   Notes: Save next to index.html and update head link to: <link rel="stylesheet" href="style.css">
*/

/* =========================
   Variables & Reset
   ========================= */
:root{
  --bg-grad-1: #f0faff;
  --bg-grad-2: #e6f7ff;
  --accent-1: #87ceeb;   /* skyblue */
  --accent-2: #5f9ea0;   /* cadet */
  --muted: #6b7280;
  --text: #111827;
  --card-bg: #ffffff;
  --glass: rgba(255,255,255,0.6);
  --max-width: 1200px;
  --radius: 12px;
  --shadow-sm: 0 6px 18px rgba(0,0,0,0.08);
  --shadow-md: 0 12px 28px rgba(0,0,0,0.12);
  --transition: 250ms cubic-bezier(.2,.9,.3,1);
  --container-padding: 20px;
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
html,body { height: 100%; }
body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-grad-1) 0%, var(--bg-grad-2) 100%);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: 60px;
}

/* Utility container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px var(--container-padding);
}

/* Language toggling: body has class lang-en or lang-zh */
.lang-en .lang-zh { display: none; }
.lang-zh .lang-en { display: none; }

/* =========================
   Header / Nav
   ========================= */
header {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 120;
  box-shadow: var(--shadow-sm);
  transition: padding var(--transition), box-shadow var(--transition);
  padding: 18px 0;
}

header .container {
  display: flex;
  align-items: center;
  gap: 20px;
  justify-content: space-between;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  margin-right: 8px;
  color: white;
}

#lang-switcher {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.22);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition);
}
#lang-switcher:hover { transform: translateY(-2px); background: rgba(255,255,255,0.05); }

nav ul {
  list-style: none;
  display: flex;
  gap: 18px;
  align-items: center;
  margin-left: 12px;
  flex-wrap: wrap;
}
nav a {
  color: rgba(255,255,255,0.95);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
}
nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Shrinkified header when scrolled */
header.scrolled { padding: 10px 0; box-shadow: var(--shadow-md); }

/* =========================
   Hero / Intro
   ========================= */
main .about,
main > section {
  margin-bottom: 56px;
}

.about {
  /* keep container spacing consistent */
}

.intro {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  background: var(--card-bg);
  padding: 28px;
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(0,0,0,0.03);
  transition: transform var(--transition);
}

/* Avatar */
.avatar {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 4px solid var(--accent-1);
  box-shadow: 0 10px 30px rgba(135,206,235,0.15);
  flex-shrink: 0;
}

/* Intro text */
.intro-text { flex: 1; min-width: 200px; }
.intro-text h3 { font-weight: 600; margin-bottom: 6px; color: var(--accent-2); }
.intro-text p { color: var(--muted); margin-top: 12px; font-size: 0.98rem; }

.profile-actions {
  width: min(100%, 720px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.about .profile-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  margin: 0;
  text-align: center;
}

/* signature (kai-font class already provided inline) */
.kai-font { font-family: "KaiTi", "STKaiti", "SimKai", "Microsoft YaHei", serif; font-size: 0.98rem; color: #444; }

/* Buttons */
a.button {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  color: white;
  text-decoration: none;
  font-weight: 600;
  margin-top: 12px;
  margin-right: 8px;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 6px 18px rgba(95,158,160,0.12);
}
a.button:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(95,158,160,0.12); }

/* secondary neutral button */
a.button.secondary {
  background: #f5f7fb;
  color: var(--text);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: none;
}

/* =========================
   Contact list & QR
   ========================= */
.contact-list { display:flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.contact-item {
  position: relative;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0,0,0,0.03);
  font-weight: 600;
  color: var(--text);
}

/* WeChat hover qrcode already had inline style; provide robust container styling */
.wechat-qrcode {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 10px);
  width: 200px;
  background: white;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
  z-index: 30;
}
.contact-item.wechat:hover .wechat-qrcode,
.contact-item.wechat:focus-within .wechat-qrcode { display: block; }

/* Contact cards in about.html style */
.contact-card { background: var(--card-bg); padding: 22px; border-radius: 12px; box-shadow: var(--shadow-sm); transition: transform var(--transition); }
.contact-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }

/* =========================
   Education / Lists
   ========================= */
.education-list { list-style: none; margin-top: 12px; }
.education-list li { display:flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed rgba(0,0,0,0.04); align-items:center; }
.education-time { color: var(--accent-2); font-weight:700; width:120px; flex-shrink:0; }
.education-info { color: var(--muted); }

/* =========================
   Research / Cards
   ========================= */
.research-container { display:flex; gap: 18px; flex-wrap:wrap; margin-top: 12px; }
.research-card {
  background: var(--card-bg);
  padding: 18px;
  border-radius: 12px;
  min-width: 260px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--accent-1);
}
.research-header { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.research-date { color: var(--muted); font-size: 0.9rem; }

/* =========================
   Notes / Projects / Blog
   ========================= */
.notes-container, .projects-container { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 18px; margin-top: 14px; }
.notes-card, .project-card, .blog-post {
  background: var(--card-bg);
  padding: 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}
.blog-post p { color: var(--muted); }

/* Lecture notes entry point and two-slot template grid */
.notes-view-all {
  display: flex;
  margin: 12px 0 16px;
}

.notes-view-all .notes-view-all-btn {
  width: min(100%, 420px);
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 1px solid rgba(127, 0, 255, 0.2);
  border-radius: 13px;
  background: linear-gradient(135deg, #7f00ff 0%, #a348ff 100%);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(127, 0, 255, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.notes-view-all .notes-view-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(127, 0, 255, 0.24);
  filter: saturate(1.08);
}

.notes-view-all .notes-view-all-btn:focus-visible {
  outline: 3px solid rgba(127, 0, 255, 0.24);
  outline-offset: 4px;
}

.notes-view-all-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.05rem;
}

.notes-view-all-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  text-align: left;
}

.notes-view-all-copy strong {
  font-size: 0.9rem;
  line-height: 1.25;
}

.notes-view-all-copy small {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.72rem;
}

.notes-view-all-arrow {
  margin-left: auto;
  font-size: 1.15rem;
  line-height: 1;
  transition: transform 180ms ease;
}

.notes-view-all-btn:hover .notes-view-all-arrow {
  transform: translateX(4px);
}

#notes .notes-container {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 0;
}

#notes .notes-card {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid rgba(127, 0, 255, 0.12);
  border-radius: 13px;
  background: linear-gradient(145deg, #ffffff 0%, #fbf8ff 100%);
  box-shadow: 0 8px 20px rgba(52, 28, 82, 0.07);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

#notes .notes-card:hover {
  transform: translateY(-3px);
  border-color: rgba(127, 0, 255, 0.28);
  box-shadow: 0 12px 26px rgba(52, 28, 82, 0.11);
}

.template-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.template-card-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #f0e2ff;
  color: #7f00ff;
  font-size: 1rem;
  font-weight: 800;
}

.template-index {
  color: #7f00ff;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#notes .notes-card h3 {
  margin-bottom: 6px;
  font-size: 1.02rem;
}

#notes .notes-card p {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.template-download {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f0e2ff;
  color: #6d00d8;
  font-size: 0.8rem;
  font-weight: 750;
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease;
}

a.template-download:hover {
  background: #e6ceff;
  transform: translateY(-1px);
}

.template-download.is-disabled {
  background: #f1f3f6;
  color: #7c8491;
  cursor: default;
}

.notes-card-placeholder {
  border-style: dashed !important;
}

#notes > h2 {
  font-size: 1.55rem;
  margin-bottom: 0;
}

/* =========================
   Locations grid
   ========================= */
.locations-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 18px; margin-top: 14px; }
.location-card { background: var(--card-bg); padding: 20px; border-radius: 12px; box-shadow: var(--shadow-sm); border-left: 4px solid var(--accent-1); transition: transform var(--transition); }
.location-card:hover { transform: translateY(-8px); border-left-color: var(--accent-2); box-shadow: var(--shadow-md); }
.location-icon { width:60px; height:60px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:1.8rem; background: linear-gradient(135deg,#e6f7ff,#d0efff); margin-bottom:12px; }

/* =========================
   Footer / Scrolling text
   ========================= */
footer {
  margin-top: 40px;
  padding: 28px 0;
  background: linear-gradient(135deg,var(--accent-1),var(--accent-2));
  color: #fff;
  text-align: center;
  border-radius: 8px;
}

.scrolling-text {
  overflow: hidden;
  white-space: nowrap;
  margin-top: 12px;
  padding: 8px 0;
}
.scrolling-text span {
  display: inline-block;
  padding-left: 100%;
  animation: scroll-left 20s linear infinite;
}
@keyframes scroll-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* =========================
   Small interactions & animations
   ========================= */
.paper-card { transition: opacity 0.28s ease, transform 0.28s ease; }
.fade-in { opacity: 0; transform: translateY(20px); transition: opacity 0.7s ease, transform 0.7s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* QR popup used in about.html and index */
.qr-code-popup {
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%) scale(0.95);
  background: white;
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  transition: all 180ms ease;
  z-index: 40;
}
.contact-card:hover .qr-code-popup { opacity: 1; pointer-events: auto; transform: translateX(-50%) scale(1); }

/* =========================
   Accessibility tweaks
   ========================= */
a, button { outline-offset: 3px; }
a:focus, button:focus { box-shadow: 0 0 0 3px rgba(135,206,235,0.18); border-radius: 8px; }

/* =========================
   Responsive
   ========================= */
@media (max-width: 900px) {
  .intro { flex-direction: column; align-items: center; text-align: center; }
  .avatar { width: 140px; height: 140px; }
  .intro-text h3 { text-align: center; }
  nav ul { gap: 12px; }
  .container { padding: 36px 18px; }
}

@media (max-width: 600px) {
  header .container { flex-direction: column; gap: 10px; align-items: stretch; }
  nav ul { flex-direction: column; align-items: center; }
  .avatar { width: 120px; height: 120px; }
  .contact-list { justify-content: center; }
  .profile-actions { grid-template-columns: 1fr; }
  #notes .notes-container { grid-template-columns: 1fr; }
  .notes-view-all .notes-view-all-btn { width: 100%; }
  .notes-view-all-copy small { display: none; }
}

/* Print */
@media print {
  body { background: white; color: black; }
  header, footer, .scrolling-text { display: none; }
  .intro, .about-grid, .location-card, .contact-card { box-shadow: none; border: 1px solid #e5e7eb; }
}

/* ====== Adjust header size & spacing (smaller header) ====== */
/* This block tightens the header without changing layout logic */
header {
  padding: 10px 0;               /* reduce vertical size */
  transition: padding var(--transition), box-shadow var(--transition);
}
header .container {
  padding-left: 16px;            /* slightly less horizontal padding */
  padding-right: 16px;
  align-items: center;
  gap: 12px;
}

/* Reduce name prominence but keep visibility and accessibility */
.name {
  font-size: 1.05rem;            /* smaller than before */
  font-weight: 700;
  line-height: 1;
  margin-right: 6px;
}

/* Make navigation more compact */
nav ul {
  gap: 12px;
}
nav a {
  font-size: 0.95rem;
  padding: 6px 8px;
  border-radius: 8px;
  font-weight: 600;
}

/* Compact language switcher */
#lang-switcher {
  padding: 6px 8px;
  font-size: 0.92rem;
  border-radius: 8px;
}

/* Optional: slightly smaller avatar on narrow screens */
@media (max-width:900px) {
  .avatar { width: 140px; height: 140px; }
}

