/* ============================= */
/* AIP Global Design System      */
/* ============================= */

*{ box-sizing: border-box; }

:root{
  --aip-navy: #2F3E5F;
  --aip-bg: #f6f7fb;
  --aip-card: #ffffff;
  --aip-text: #1b1f2a;
  --aip-muted: #5e677a;
  --aip-border: rgba(47,62,95,.14);

  --radius: 14px;
  --shadow: 0 10px 28px rgba(20, 24, 36, .10);
  --shadow-soft: 0 6px 18px rgba(20, 24, 36, .08);

  --pad-section: 40px;
  --pad-card: 22px;

  --btn-radius: 12px;
}

/* ============================= */
/* Page Layout (sticky footer)   */
/* ============================= */

html, body{ height: 100%; }

body{
  margin: 0;

  /* KEEP your typography/theme */
  font-family: "Open Sans", "Lato", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--aip-text);
  background: var(--aip-bg);

  /* IMPORTANT: body does NOT need to be flex if footer is inside .site-wrap */
  min-height: 100vh;
}

/* Make site-wrap the flex column that contains main + footer */
.site-wrap{
  position: relative;
  z-index: 1;

  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Your main wrapper should grow and push footer down */
.main-content{ flex: 1 0 auto; }

/* main itself can also be flex-grow; harmless even if nested */
.site-main{ flex: 1 0 auto; }

.site-footer{
  margin-top: auto;
  flex: 0 0 auto;
}


/* ============================= */
/* Header / Main                 */
/* ============================= */

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

.site-main{
	flex: 1;	
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}


/* ============================= */
/* Typography                    */
/* ============================= */

h1,h2,h3{
  font-family: "Montserrat", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0 0 10px;
  letter-spacing: -0.2px;
}

p{
  margin: 0 0 12px;
  color: var(--aip-muted);
  line-height: 1.55;
}

.small{ font-size: 13px; }
.muted{ color: var(--aip-muted); }

/* ============================= */
/* Containers / Cards            */
/* ============================= */

.container{
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.section{ padding: var(--pad-section) 0; }

.card{
  background: var(--aip-card);
  border: 1px solid var(--aip-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: var(--pad-card);
  margin: 14px 0;
  overflow: hidden;
}

/* ============================= */
/* Forms                         */
/* ============================= */

.row{
  display:flex;
  gap: 14px;
  flex-wrap:wrap;
  align-items:center;
}


/* Fix “5px overflow” in narrow popups (flex + inputs) */
.col{
  flex: 1 1 280px;
  min-width: 0; /* critical for flex children */
}

input, textarea, select{
  width: 100%;
  box-sizing: border-box;
  display: block;
}

label{
  display:block;
  font-weight: 700;
  margin: 10px 0 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"]{
  width: 100%;
  padding: 10px;
  border: 1px solid #ccd;
  border-radius: 8px;
  font-size: 15px;
  margin-bottom: 12px;
}

/* Prevent buttons from touching last field on expanding forms */
form button,
form .btn{
  margin-top: 12px;
}

.form-actions{
  margin-top: 16px;
}

.form-actions .btn,
.form-actions button{
  margin-top: 0;
}

/* Password eye toggle */
.pw-wrap{
  position:relative;
  display:flex;
  align-items:center;
}

.pw-wrap input{ padding-right:40px; }

.eye{
  position:absolute;
  right:12px;
  cursor:pointer;
  font-size:18px;
  user-select:none;
  opacity:0.7;
  transition:opacity 0.2s ease;
}

.eye:hover{ opacity:1; }

/* ============================= */
/* Buttons (anchor + button)     */
/* ============================= */

.btn,
button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;

  border-radius: var(--btn-radius);
  padding: 12px 16px;
  border: 1px solid var(--aip-border);
  background: #fff;
  color: var(--aip-text);
  text-decoration:none;
  cursor:pointer;
  font-weight: 600;
}

.btn-primary,
button{
  background: var(--aip-navy);
  color:#fff;
  border-color: rgba(255,255,255,.15);
}

button.secondary{ background: #4d5f8f; border-color: transparent; }
button:disabled{ opacity: 0.6; cursor: not-allowed; }

.btn:hover{ transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn:active{ transform: translateY(0px); }

/* ============================= */
/* Messages                      */
/* ============================= */

.notice{
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 197, 94, .10);
  border: 1px solid rgba(34, 197, 94, .30);
  color: #14532d;
  font-weight: 600;
}

.error{
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(239, 68, 68, .10);
  border: 1px solid rgba(239, 68, 68, .30);
  color: #7f1d1d;
  font-weight: 600;
}

.hidden{ display:none; }

/* ============================= */
/* Footer                        */
/* ============================= */

.site-footer{
  background: var(--aip-navy);
  color: rgba(255,255,255,.86);
  padding: 22px 0;
  margin-top: 40px;
  text-align:center;
}

.footer-inner{
  font-weight: 600;
  letter-spacing: .1px;
}

.site-footer a{ color: rgba(255,255,255,.92); text-decoration:none; }
.site-footer a:hover{ text-decoration:underline; }

.footer-links{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }
.footer-meta{ margin-top: 10px; font-size: 13px; opacity: .85; }
.dot{ opacity:.7; }

/* ============================= */
/* DLBook Page                   */
/* ============================= */

.dlbook-header-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}

.dlbook-giveaway{
  margin-top: 14px;
  box-shadow: var(--shadow-soft);
}

.books-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:28px;
  max-width: 980px;
  margin: 18px auto 0;
}
/* header for main card containing book cards */
.dlbook-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.dlbook-header-top h2 {
  margin: 0;
}

.book-card{
  border-radius: var(--radius);
  padding: 16px;
  background: var(--aip-card);
  border: 1px solid var(--aip-border);
  transition: all 0.25s ease;
  box-shadow: var(--shadow-soft);
  text-align:center;
}

.book-card:hover{
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: var(--aip-navy);
}

.thumb-wrap{
  position:relative;
  display:inline-block;
  border-radius: 12px;
  overflow:hidden;
}

.book-thumb{
  display:block;
  width:100%;
  max-width:240px;
  border-radius:12px;
  transition: transform 0.25s ease;
}

.book-card:hover .book-thumb{ transform: scale(1.03); }

.thumb-overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:34px;
  background: rgba(47,62,95,0.55);
  color:#fff;
  opacity:0;
  transition: opacity 0.25s ease;
  text-decoration:none;
}

.book-card:hover .thumb-overlay{ opacity:1; }

.book-actions{
  display:flex;
  gap:10px;
  justify-content:center;
  margin-top:14px;
  flex-wrap:wrap;
}

.book-title{
  margin-top:14px;
  font-weight:700;
  color: var(--aip-navy);
}

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

.review-layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.review-book {
  width: 220px;
  text-align: center;
}

.review-book img {
  width: 100%;
  border: 1px solid #ddd;
}

.review-form {
  flex: 1;
}

.review-form select,
.review-form textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 15px;
  font-size: 14px;
}

#wordCount {
  font-size: 13px;
  color: #666;
  margin-bottom: 15px;
}

.review-link{
  font-weight:700;
  text-decoration:underline;
  color: var(--aip-navy);
  text-underline-offset: 3px;
}

.review-link:hover{ text-decoration: underline; }

/* Fractional Stars */
.rating{ display:flex; align-items:center; gap:10px; }

.stars{
  --rating: 0;
  --star-size: 18px;
  --star-color: #d6d7dd;
  --star-fill: #d4af37;

  position: relative;
  display: inline-block;
  font-size: var(--star-size);
  line-height: 1;
}

.stars::before{
  content:"★★★★★";
  letter-spacing: 2px;
  color: var(--star-color);
}

.stars::after{
  content:"★★★★★";
  letter-spacing: 2px;
  color: var(--star-fill);
  position:absolute;
  left:0;
  top:0;
  width: calc((var(--rating) / 5) * 100%);
  overflow:hidden;
  white-space: nowrap;
}

.rating-meta{ color: var(--aip-muted); font-weight:700; }



/* ============================= */
/* Responsive                    */
/* ============================= */

@media (max-width: 720px){
  .book-edges::before,
  .book-edges::after{ display:none; }

  .site-main{ overflow-x: hidden; }
  .site-header,
  .site-footer{
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 700px){
  .books-grid{ grid-template-columns: 1fr; }
  .rating-row{ flex-direction: column; align-items:center; }
}

@media (max-width: 860px) {
  .review-layout { flex-direction: column; }
  .review-book { width: 100%; max-width: 260px; margin: 0 auto; }
}

/* General links (non-footer) */
a{ color: var(--aip-navy); }

html, body { height: 100%; }
body { min-height: 100%; display: flex; flex-direction: column; }
main { flex: 1; }

