/* ==========================================================================
   HAMSTER CORNER - DESIGN SYSTEM
   ========================================================================== */

:root {
  /* COLOR PALETTE */
  --color-primary: #FF5722;
  --color-secondary: #14B8A6;
  --color-white: #FFFFFF;

  /* GRAYS */
  --color-gray-50: #F9FAFB;
  --color-gray-100: #F3F4F6;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-400: #9CA3AF;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;
  --color-gray-700: #374151;
  --color-gray-800: #1F2937;
  --color-gray-900: #111827;

  /* SEMANTIC COLORS */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-danger: #EF4444;
  --color-info: #3B82F6;

  /* TYPOGRAPHY */
  --font-display: 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;

  /* TYPE SCALE */
  --h1-size: clamp(18px, 3vw, 28px);
  --h2-size: clamp(16px, 2.5vw, 22px);
  --h3-size: clamp(14px, 2vw, 18px);
  --h4-size: 14px;
  --h5-size: 13px;
  --h6-size: 12px;
  --body-size: 17px;
  --caption-size: 12px;

  --line-height-tight: 1.2;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.8;

  /* SPACING SCALE (4pt system) */
  --s-1: 2px;
  --s-2: 4px;
  --s-3: 6px;
  --s-4: 8px;
  --s-5: 10px;
  --s-6: 12px;
  --s-7: 16px;
  --s-8: 24px;
  --s-9: 32px;
  --s-10: 48px;

  /* BORDER RADIUS */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-full: 999px;

  /* SHADOWS */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);

  /* CONTAINER WIDTHS */
  --grid-content: 720px;
  --grid-wide: 1160px;
  --grid-wide-toc: 1420px;

  /* BREAKPOINTS */
  --bp-mobile: 600px;
  --bp-tablet: 900px;
  --bp-desktop: 1200px;
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--body-size);
  font-weight: 500;
  line-height: var(--line-height-normal);
  color: var(--color-gray-900);
  background-color: var(--color-white);
}

a {
  color: var(--color-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #0D9488;
  text-decoration: underline;
}

/* ==========================================================================
   MOBILE SAFETY NET — prevents horizontal scroll & overflow site-wide
   ========================================================================== */

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

/* Media never wider than its container */
img,
video,
iframe,
embed,
object {
  max-width: 100%;
  height: auto;
}

/* Long words / URLs wrap instead of pushing the layout wide */
h1, h2, h3, h4, h5, h6, p, a, span, li, td {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Wide tables scroll inside their own box, not the whole page */
table {
  max-width: 100%;
}

/* Anything that tries to set a fixed pixel width gets capped on small screens */
@media (max-width: 600px) {
  [style*="width: 1200px"],
  [style*="width:1200px"],
  [width="1200"] {
    max-width: 100% !important;
  }
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, .h1 {
  font-family: var(--font-display);
  font-size: var(--h1-size);
  font-weight: 700;
  line-height: var(--line-height-tight);
}

h2, .h2 {
  font-family: var(--font-display);
  font-size: var(--h2-size);
  font-weight: 700;
  line-height: var(--line-height-tight);
}

h3, .h3 {
  font-family: var(--font-display);
  font-size: var(--h3-size);
  font-weight: 700;
  line-height: var(--line-height-tight);
}

h4, .h4 {
  font-family: var(--font-display);
  font-size: var(--h4-size);
  font-weight: 600;
}

h5, .h5 {
  font-family: var(--font-display);
  font-size: var(--h5-size);
  font-weight: 600;
}

h6, .h6 {
  font-family: var(--font-display);
  font-size: var(--h6-size);
  font-weight: 600;
}

p {
  margin-bottom: var(--s-4);
}

p:last-child {
  margin-bottom: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-gray-100);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  display: inline-block;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  border: none;
  font-family: var(--font-body);
  font-size: var(--body-size);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

/* Primary Button */
.btn-primary, .btn.primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:hover,
.btn.primary:hover {
  background-color: #E64A19;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:focus,
.btn.primary:focus {
  outline: 3px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Secondary Button */
.btn-secondary, .btn.secondary {
  background-color: var(--color-secondary);
  color: var(--color-white);
}

.btn-secondary:hover,
.btn.secondary:hover {
  background-color: #0D9488;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary:focus,
.btn.secondary:focus {
  outline: 3px solid var(--color-secondary);
  outline-offset: 2px;
}

/* Ghost Button */
.btn-ghost, .btn.ghost {
  background-color: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.btn-ghost:hover,
.btn.ghost:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-ghost:focus,
.btn.ghost:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Small Button */
.btn-sm {
  padding: var(--s-2) var(--s-4);
  font-size: 14px;
}

/* Large Button */
.btn-lg {
  padding: var(--s-5) var(--s-7);
  font-size: 18px;
}

/* ==========================================================================
   PILLS / BADGES
   ========================================================================== */

.pill {
  display: inline-block;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
  font-size: var(--caption-size);
  font-weight: 600;
  white-space: nowrap;
}

.pill.primary {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.pill.secondary {
  background-color: var(--color-secondary);
  color: var(--color-white);
}

.pill.success {
  background-color: var(--color-success);
  color: var(--color-white);
}

.pill.warning {
  background-color: var(--color-warning);
  color: var(--color-white);
}

.pill.danger {
  background-color: var(--color-danger);
  color: var(--color-white);
}

.pill.info {
  background-color: var(--color-info);
  color: var(--color-white);
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
  background: var(--color-white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: var(--s-6);
  border-bottom: 1px solid var(--color-gray-200);
}

.card-header h3 {
  margin: 0;
}

.card-body {
  padding: var(--s-6);
}

.card-footer {
  padding: var(--s-6);
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
}

/* ==========================================================================
   GRID LAYOUT
   ========================================================================== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-6);
}

.grid.defensive {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* ==========================================================================
   CONTAINERS
   ========================================================================== */

.container {
  max-width: var(--grid-content);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--s-3);
  padding-right: var(--s-3);
}

.container.wide {
  max-width: var(--grid-wide);
}

.container.wide-toc {
  max-width: var(--grid-wide-toc);
}

@media (max-width: 600px) {
  .container {
    padding-left: var(--s-3);
    padding-right: var(--s-3);
  }
}

/* ==========================================================================
   FORMS
   ========================================================================== */

label {
  display: block;
  margin-bottom: var(--s-2);
  font-weight: 600;
  color: var(--color-gray-900);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: var(--body-size);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* ==========================================================================
   UTILITY CLASSES - SPACING
   ========================================================================== */

.mt-1 { margin-top: var(--s-1); }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.mt-6 { margin-top: var(--s-6); }
.mt-7 { margin-top: var(--s-7); }
.mt-8 { margin-top: var(--s-8); }

.mb-1 { margin-bottom: var(--s-1); }
.mb-2 { margin-bottom: var(--s-2); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }
.mb-5 { margin-bottom: var(--s-5); }
.mb-6 { margin-bottom: var(--s-6); }
.mb-7 { margin-bottom: var(--s-7); }
.mb-8 { margin-bottom: var(--s-8); }

.px-4 { padding-left: var(--s-4); padding-right: var(--s-4); }
.px-6 { padding-left: var(--s-6); padding-right: var(--s-6); }

.py-4 { padding-top: var(--s-4); padding-bottom: var(--s-4); }
.py-6 { padding-top: var(--s-6); padding-bottom: var(--s-6); }

/* ==========================================================================
   UTILITY CLASSES - TEXT
   ========================================================================== */

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-muted { color: var(--color-gray-500); }

.border-primary { border-color: var(--color-primary); }
.border-secondary { border-color: var(--color-secondary); }

.underline-secondary {
  border-bottom: 2px solid var(--color-secondary);
  padding-bottom: 2px;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* ==========================================================================
   UTILITY CLASSES - LAYOUT
   ========================================================================== */

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-6 { gap: var(--s-6); }

/* ==========================================================================
   UTILITY CLASSES - BACKGROUND & BORDER
   ========================================================================== */

.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-gray { background-color: var(--color-gray-100); }
.bg-white { background-color: var(--color-white); }

.border-top { border-top: 1px solid var(--color-gray-200); }
.border-bottom { border-bottom: 1px solid var(--color-gray-200); }
.border-top-secondary { border-top: 2px solid var(--color-secondary); }
.border-bottom-secondary { border-bottom: 2px solid var(--color-secondary); }

.accent-secondary {
  position: relative;
  padding-left: 12px;
}

.accent-secondary::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--color-secondary);
}

/* ==========================================================================
   POST CARD - REUSABLE BLOG DESIGN
   ========================================================================== */

.post-card {
  background: var(--color-white);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  border: 0.5px solid var(--color-border-tertiary);
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: var(--shadow-sm);
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-secondary);
}

.post-card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-primary), #E64A19);
  position: relative;
}

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

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

.post-card-body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  flex: 1;
}

.post-card-category {
  display: inline-block;
  background: var(--color-secondary);
  color: var(--color-white);
  padding: var(--s-2) var(--s-4);
  border-radius: var(--border-radius-md);
  font-size: var(--caption-size);
  font-weight: 700;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  width: fit-content;
}

.post-card-category:hover {
  background: #0D9488;
  transform: scale(1.05);
}

.post-card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: var(--line-height-tight);
}

.post-card-title a {
  color: var(--color-gray-900);
  text-decoration: none;
  transition: color 0.2s ease;
}

.post-card-title a:hover {
  color: var(--color-secondary);
  text-decoration: underline;
}

.post-card-excerpt {
  color: var(--color-gray-600);
  font-size: 13px;
  line-height: 1.5;
  flex: 1;
}

.post-card-footer {
  display: flex;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid var(--color-border-tertiary);
  color: var(--color-gray-500);
  font-size: 11px;
  font-weight: 500;
}

/* ==========================================================================
   GRID PATTERN - REUSABLE OVERLAY (Finance Pulse style)
   ========================================================================== */

/* Add to any solid-colored section to get the subtle grid overlay.
   The element MUST have position: relative and its own background color.
   Children should sit above via position: relative / z-index. */
.grid-pattern {
  position: relative;
}

.grid-pattern::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(255, 255, 255, 0.12) 39px,
      rgba(255, 255, 255, 0.12) 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 39px,
      rgba(255, 255, 255, 0.12) 39px,
      rgba(255, 255, 255, 0.12) 40px
    );
  pointer-events: none;
  z-index: 0;
}

/* Darker grid lines for use on light/white backgrounds */
.grid-pattern-dark::before {
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(255, 87, 34, 0.06) 39px,
      rgba(255, 87, 34, 0.06) 40px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 39px,
      rgba(255, 87, 34, 0.06) 39px,
      rgba(255, 87, 34, 0.06) 40px
    );
}

/* Keep real content above the grid overlay */
.grid-pattern > * {
  position: relative;
  z-index: 1;
}

/* ==========================================================================
   TEXTURE - LATTICE PATTERN
   ========================================================================== */

.lattice {
  background-image:
    linear-gradient(0deg, transparent 24%, rgba(255, 255, 255, 0.1) 25%, rgba(255, 255, 255, 0.1) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, 0.1) 75%, rgba(255, 255, 255, 0.1) 76%, transparent 77%, transparent),
    linear-gradient(90deg, transparent 24%, rgba(255, 255, 255, 0.1) 25%, rgba(255, 255, 255, 0.1) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, 0.1) 75%, rgba(255, 255, 255, 0.1) 76%, transparent 77%, transparent);
  background-size: 50px 50px;
}

/* ==========================================================================
   RESPONSIVE UTILITIES
   ========================================================================== */

@media (max-width: 900px) {
  .hide-tablet {
    display: none;
  }
}

@media (max-width: 600px) {
  .hide-mobile {
    display: none;
  }

  h1, .h1 {
    font-size: clamp(28px, 5vw, 40px);
  }

  h2, .h2 {
    font-size: clamp(24px, 4vw, 32px);
  }

  h3, .h3 {
    font-size: clamp(20px, 3vw, 24px);
  }
}

/* ==========================================================================
   COMMENTS — "Leave a Reply" form
   ========================================================================== */

.comments-area,
#comments {
  margin-top: 0;
}

.comments-title,
.comment-reply-title {
  font-family: var(--font-display);
  font-size: var(--h3-size);
  font-weight: 700;
  color: var(--color-gray-900);
  margin: 0 0 var(--s-2);
}

.comment-reply-title small { font-weight: 500; font-size: 14px; }

.comment-notes {
  flex: 0 0 100%;
  color: var(--color-gray-500);
  font-size: 14px;
  margin: 0 0 var(--s-4);
}

.comment-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-5);
}

.comment-form > p { margin: 0; }

.comment-form-comment { flex: 0 0 100%; }

.comment-form label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-gray-700);
  margin-bottom: var(--s-2);
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--color-gray-200);
  border-radius: var(--r-md);
  background: var(--color-gray-50);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-gray-900);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.comment-form textarea { min-height: 180px; resize: vertical; }

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.1);
}

/* Name + Email side by side */
.comment-form-author,
.comment-form-email {
  flex: 1 1 calc(50% - var(--s-5));
  min-width: 240px;
}

/* Hide the website field */
.comment-form-url { display: none; }

.comment-form-cookies-consent {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}
.comment-form-cookies-consent input { width: auto; }
.comment-form-cookies-consent label {
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
  font-size: 12px;
  color: var(--color-gray-600);
}

.form-submit { flex: 0 0 100%; margin: 0; }

.comment-form .submit,
.form-submit input[type="submit"] {
  background: var(--color-primary);
  color: #FFFFFF;
  border: none;
  padding: 0.85rem 2rem;
  border-radius: var(--r-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.comment-form .submit:hover,
.form-submit input[type="submit"]:hover {
  background: #E64A19;
  transform: translateY(-1px);
}

/* Existing comments list */
.comment-list { list-style: none; margin: var(--s-7) 0 0; padding: 0; }
.comment-list .children { list-style: none; margin-left: var(--s-6); padding: 0; }
.comment-list .comment { margin-bottom: var(--s-5); }
.comment-body {
  background: var(--color-gray-50);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
}
.comment-author .fn { font-weight: 700; color: var(--color-gray-900); font-style: normal; }
.comment-metadata { font-size: 12px; color: var(--color-gray-500); margin-top: 2px; }
.comment-metadata a { color: var(--color-gray-500); }
.reply a {
  display: inline-block;
  margin-top: var(--s-2);
  font-weight: 700;
  font-size: 13px;
  color: var(--color-primary);
  text-decoration: none;
}

@media (max-width: 600px) {
  .comment-form-author,
  .comment-form-email { flex: 0 0 100%; }
}
