/* ---------------------------------------------------------------------------
   Island Preferred — blog styles.

   The React bundle's CSS is loaded first and supplies the theme tokens and the
   Tailwind utilities the templates reuse. Everything here is either (a) a
   component class the utility build cannot provide, or (b) article typography:
   the app was built without the Tailwind typography plugin, so `.prose` does
   not exist in that bundle and post bodies would otherwise render unstyled.

   Every custom class is prefixed `ip-` so it can never collide with Tailwind.
--------------------------------------------------------------------------- */

:root {
  /* Fallbacks only — the app bundle defines these first and wins if present. */
  --ip-primary: var(--primary, #0f3b66);
  --ip-accent: var(--accent, #d4a574);
  --ip-background: var(--background, #fffaf0);
  --ip-foreground: var(--foreground, #1f2937);
  --ip-muted: var(--muted-foreground, #6b7280);
  --ip-border: var(--border, #e5e7eb);
  --ip-card: var(--card, #fff);
  --ip-radius: var(--radius, 0.5rem);
  --ip-serif: "Playfair Display", Georgia, serif;
  --ip-sans: Lato, system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--ip-sans);
  background: var(--ip-background);
  color: var(--ip-foreground);
}

/* --- Navigation ---------------------------------------------------------- */

.ip-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(255 255 255 / 95%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ip-border);
}

.ip-logo {
  height: 2.75rem;
  width: auto;
  border-radius: 0.25rem;
  object-fit: contain;
}

/* --- Layout -------------------------------------------------------------- */

.ip-blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.ip-sidebar { order: 2; }
.ip-posts   { order: 1; min-width: 0; }

@media (min-width: 768px) {
  .ip-blog-grid { grid-template-columns: 1fr 3fr; gap: 2rem; }
  .ip-sidebar   { order: 1; align-self: start; position: sticky; top: 6rem; }
  .ip-posts     { order: 2; }
}

.ip-card {
  background: var(--ip-card);
  border: 1px solid var(--ip-border);
  border-radius: var(--ip-radius);
  box-shadow: 0 1px 3px rgb(15 59 102 / 6%);
  overflow: hidden;
}

/* --- Category list ------------------------------------------------------- */

.ip-cat {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: var(--ip-foreground);
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ip-cat:hover { background: rgb(212 165 116 / 12%); }

.ip-cat.is-active {
  background: rgb(212 165 116 / 20%);
  color: var(--ip-primary);
  font-weight: 600;
}

/* --- Post cards ---------------------------------------------------------- */

.ip-post-card {
  display: grid;
  grid-template-columns: 1fr;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ip-post-card:hover {
  box-shadow: 0 12px 28px rgb(15 59 102 / 12%);
  transform: translateY(-2px);
}

.ip-post-thumb {
  display: block;
  overflow: hidden;
  background: rgb(15 59 102 / 5%);
  aspect-ratio: 16 / 10;
}

.ip-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.ip-post-card:hover .ip-post-thumb img { transform: scale(1.05); }

.ip-post-body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}

.ip-post-title {
  display: block;
  font-family: var(--ip-serif);
  line-height: 1.25;
  text-decoration: none;
}

.ip-readmore {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
}

@media (min-width: 768px) {
  .ip-post-card { grid-template-columns: 1fr 2fr; }
  .ip-post-thumb { aspect-ratio: auto; height: 100%; }
}

/* --- Buttons ------------------------------------------------------------- */

.ip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.ip-btn-primary { background: var(--ip-primary); color: #fff; }
.ip-btn-primary:hover { background: rgb(15 59 102 / 90%); }

.ip-btn-accent { background: var(--ip-accent); color: var(--ip-primary); }
.ip-btn-accent:hover { background: rgb(212 165 116 / 90%); }

.ip-btn-outline { border-color: var(--ip-border); color: var(--ip-primary); background: var(--ip-card); }
.ip-btn-outline:hover { background: rgb(212 165 116 / 12%); }

.ip-btn-ghost { border-color: #fff; color: #fff; background: transparent; }
.ip-btn-ghost:hover { background: rgb(255 255 255 / 10%); }

.ip-btn.is-disabled { opacity: 0.45; pointer-events: none; }

/* --- Single post --------------------------------------------------------- */

.ip-back {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  text-decoration: none;
}

.ip-hero-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--ip-radius);
  margin-bottom: 2rem;
  background: rgb(15 59 102 / 5%);
}

.ip-share {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-bottom: 1px solid var(--ip-border);
}

.ip-share a { color: var(--ip-primary); }

@media (min-width: 640px) {
  .ip-share { flex-direction: row; align-items: center; justify-content: space-between; }
}

.ip-related {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.ip-related-card {
  text-decoration: none;
  display: block;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ip-related-card:hover { box-shadow: 0 12px 28px rgb(15 59 102 / 12%); transform: translateY(-2px); }

.ip-related-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: rgb(15 59 102 / 5%);
}

@media (min-width: 640px) {
  .ip-related { grid-template-columns: repeat(3, 1fr); }
}

.ip-notfound {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
}

.ip-preview-bar {
  background: var(--ip-primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  text-align: center;
  font-size: 0.875rem;
}

.ip-preview-bar a { color: var(--ip-accent); margin-left: 0.75rem; text-decoration: underline; }

/* --- Footer -------------------------------------------------------------- */

.ip-footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .ip-footer-grid { grid-template-columns: repeat(4, 1fr); }
}

.ip-muted-white { color: rgb(255 255 255 / 70%); }
.ip-muted-white:hover { color: #fff; }

.ip-footer-bottom {
  display: flex;
  flex-direction: column;
  border-top-color: rgb(255 255 255 / 10%);
}

@media (min-width: 768px) {
  .ip-footer-bottom { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* --- Article typography (the missing `.prose`) --------------------------- */

.ip-prose {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--ip-foreground);
  max-width: none;
  overflow-wrap: break-word;
}

.ip-prose > :first-child { margin-top: 0; }
.ip-prose > :last-child { margin-bottom: 0; }

.ip-prose h2 {
  font-family: var(--ip-serif);
  font-size: 1.875rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ip-primary);
  margin: 2.5rem 0 1rem;
}

.ip-prose h3 {
  font-family: var(--ip-serif);
  font-size: 1.375rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--ip-primary);
  margin: 2rem 0 0.75rem;
}

.ip-prose h4 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ip-primary);
  margin: 1.5rem 0 0.5rem;
}

.ip-prose p { margin: 0 0 1.25rem; }

.ip-prose ul,
.ip-prose ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }

.ip-prose ul { list-style: disc; }
.ip-prose ol { list-style: decimal; }
.ip-prose li { margin-bottom: 0.5rem; }
.ip-prose li::marker { color: var(--ip-accent); }

.ip-prose a {
  color: var(--ip-primary);
  text-decoration: underline;
  text-decoration-color: var(--ip-accent);
  text-underline-offset: 3px;
}

.ip-prose a:hover { color: var(--ip-accent); }

.ip-prose strong { font-weight: 700; color: var(--ip-primary); }
.ip-prose em { font-style: italic; }

.ip-prose blockquote {
  margin: 1.75rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--ip-accent);
  color: var(--ip-muted);
  font-style: italic;
}

.ip-prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--ip-radius);
  margin: 1.75rem 0;
}

.ip-prose figure { margin: 1.75rem 0; }
.ip-prose figcaption { font-size: 0.875rem; color: var(--ip-muted); text-align: center; margin-top: 0.5rem; }

.ip-prose hr { border: 0; border-top: 1px solid var(--ip-border); margin: 2.5rem 0; }

.ip-prose code {
  background: rgb(15 59 102 / 6%);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

.ip-prose pre {
  background: var(--ip-primary);
  color: #fff;
  padding: 1rem 1.25rem;
  border-radius: var(--ip-radius);
  overflow-x: auto;
  margin: 1.75rem 0;
}

.ip-prose pre code { background: none; padding: 0; color: inherit; }

/* Wide tables scroll inside the article instead of stretching the page. */
.ip-prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1.75rem 0;
  font-size: 0.9375rem;
}

.ip-prose th,
.ip-prose td { border: 1px solid var(--ip-border); padding: 0.625rem 0.875rem; text-align: left; }
.ip-prose th { background: rgb(15 59 102 / 5%); color: var(--ip-primary); font-weight: 700; }

@media (min-width: 768px) {
  .ip-prose { font-size: 1.125rem; }
  .ip-prose h2 { font-size: 2.125rem; }
  .ip-prose h3 { font-size: 1.5rem; }
}

/* --- Print --------------------------------------------------------------- */

@media print {
  .ip-nav, .ip-share, .ip-related, .ip-preview-bar, footer { display: none; }
  .ip-prose { font-size: 11pt; }
}
