@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;600;700&display=swap');

:root {
  --black: #000000;
  --white: #ffffff;
  --muted: #ffffff;
  --accent: #4EA1FF;
  --font-size-base: 1rem;
  --font-size-md: clamp(1.25rem, 0.61vw + 1.1rem, 1.58rem);
  --font-size-lg: clamp(1.56rem, 1vw + 1.31rem, 2.11rem);
  --font-size-xl: clamp(2.44rem, 2.38vw + 1.85rem, 3.75rem);
  --border-radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Poppins', sans-serif;
  color: var(--white);
  font-size: var(--font-size-base);
  background-color: var(--black);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Layout */
.container {
  max-width: 1200px; /* wider on laptops */
  margin: 0 auto;
  padding: 0 18px;
}

.main {
  padding: 20px 0;
}

/* Basic headings */
h1 { font-size: var(--font-size-xl); color: var(--white); margin: 0 0 8px 0; }
h2 { font-size: var(--font-size-lg); color: var(--white); margin: 0 0 8px 0; }
h3 { font-size: var(--font-size-md); color: var(--white); margin: 0 0 8px 0; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  display: block;
  box-sizing: border-box;
  width: 100%;
  padding: 0.7rem 0.75rem;
  margin-bottom: 1rem;
  background: #111;
  color: var(--white);
  border: 1px solid #222;
  border-radius: 6px;
}

/* Buttons */
.btn {
  background-color: var(--white);
  border: none;
  color: var(--black); 
  padding: 10px 18px;
  text-decoration: none;
  margin: 4px 2px; 
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
}

.btn-delete {
  padding: 10px 16px;
  background-color: #b30000;
  color: var(--white);
}

/* images */
img {
  width: 100%;
  height: auto;
  display: block;
}

/* Hero */
.hero-image {
  max-height: 528px;
  overflow: hidden;
  border-radius: var(--border-radius);
  box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

/* Header */
.header {
  display: grid;
  align-items: center;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto;
  grid-template-areas: 
  "logo button"
  "menu menu";
  padding-top: 10px;
  gap: 10px;
}

@media only screen and (min-width: 768px) {
  .header {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: 
    "logo menu button";
  }
}

.header__logo {
  font-weight: 800;
  font-size: 25px;
  text-decoration: none;
  grid-area: logo;
  color: var(--white); /* ensure visible */
}

.header__logo:hover {
  text-decoration: underline;
}

.header__nav {
  justify-content: center;
  display: flex;
  grid-area: menu;
}

.header__logo, .header__nav, .header__button {
  width: 100%;
}

.header__button {
  display: flex;
  justify-content: end;
  grid-area: button;
  align-items: center;
  gap: 8px;
}

/* Header button styles */
.header__button button {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  border: 0;
  padding: 6px 12px;
  background: none;
  border-radius: 10px;
  border: 2px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
}

.header__button button:hover {
  border: 2px solid var(--white);
}

/* Social icons as images */
.header__button a.social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
}

.header__button a.social img {
  width: 20px;
  height: 20px;
  display: block;
  filter: brightness(0) invert(1); /* makes logos white on dark theme */
}

/* Header -> Navigation */
.header__nav ul {
  list-style-type: none;
  display: flex;
  gap: 1rem;
  font-weight: 600;
  padding: 0;
  margin: 0;
}

.header__nav ul a {
  padding: 10px;
  text-decoration: none;
  color: var(--white); /* ensure non-selected nav items are white */
}

.header__nav ul a.active {
  color: var(--accent); /* active link blue */
}

.header__nav ul a:hover {
  text-decoration: underline;
}

/* Author - HomePage */
.author {
  padding: 10px 0;
  text-align: left;
}

.author__heading {
  margin-top: 10px;
  margin-bottom: 5px;
}

.author__body {
  font-size: var(--font-size-md);
  margin: 5px 0 40px 0;
  color: var(--white);
}

.articles__heading {
  margin-top: 4rem;
  font-weight: 400;
  color: var(--accent);
}

.article-ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
  font-size: clamp(1.13rem, calc(1.08rem + 0.22vw), 1.25rem);
  display: flex;
  flex-direction: column;
}

.article-list__date {
  font-size: 1rem;
  color: var(--white); /* make date white */
  width: 100px;
  display: inline-block;
  width: 260px;
}

.article-ul li a {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  margin: 18px 0;
  color: var(--white); /* ensure links in list are white */
}

@media only screen and (min-width: 768px) {
  .article-ul li a {
    flex-direction: row;
    align-items: center;
  }

  .article-list__date {
    text-align: right;
  }
}

.article-ul li {
  font-size: 24px;
  cursor: pointer;
  transition: none;
}

.article-ul li:not(:last-child) {
  border-bottom: 2px solid rgba(255,255,255,0.25);
  padding-bottom: 12px;
  margin-bottom: 12px;
  transition: border-color 150ms ease, transform 120ms ease;
}

.article-ul li:hover {
  border-bottom-color: rgba(255,255,255,0.42);
  transform: translateY(-1px);
}

.article {
  white-space: pre-wrap;
  color: var(--white); /* article text white */
}

/* Footer */
.footer {
  margin: 4rem;
  text-align: center;
  color: var(--white);
}

/* Dashboard Admin */
.admin-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-posts {
  padding: 0;
  margin: 0;
}

.admin-post-controls form {
  display: inline-block;
}

.admin-post-controls .btn  {
  display: inline-block;
  background-color: var(--white);
  color: var(--black);
  border: 0;
  text-decoration: none;
  font-size: .8rem;
  padding: 4px 8px;
  line-height: 2;
}

.admin-posts li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
}

/* SearchBar */
.searchBar {
  visibility: hidden;
  transform: translateY(-100px);
  background-color: #111;
  padding: 8px 0;
  position: absolute;
  left: 0;
  right: 0;
  z-index: 50;
}

.searchBar.open {
  transform: translateY(0);
  transition: transform 0.1s;
}

.searchBar input {
  margin: 0;
  border: 0;
  background: #111;
  color: var(--white);
}

#searchClose {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--white);
  padding: 15px;
  cursor: pointer;
}

.pagination {
  font-size: 1.3rem;
  color: var(--white);
  text-decoration: none;
  margin-top: 40px;
  display: inline-block;
}

.pagination:hover {
  color: var(--accent);
}
