* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 125px;
}

body {
  margin: 0;
  background: #f7f4ed;
  color: #242321;
  font-family: "DM Sans", sans-serif;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

/* TOP STRIP */

.topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 5.5%;
  background: #252421;
  color: #d9d1c1;
  font-size: 9px;
  letter-spacing: 1.5px;
}

.ist-label {
  color: #bda27c;
  font-size: 8px;
}

/* HEADER */

.site-header {
  background: #f7f4ed;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #ded8cc;
}

.header-main {
  position: relative;
  min-height: 125px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #242321;
  padding: 17px 10px;
}

.brand-kicker {
  font-size: 10px;
  letter-spacing: 5px;
}

.brand-name {
  font-family: "Playfair Display", serif;
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.05;
}

.brand-tagline {
  font-size: 8px;
  letter-spacing: 2.6px;
  color: #887b68;
  margin-top: 7px;
}

/* SEARCH REPOSITIONED TO THE LEFT */

.header-search {
  position: absolute;
  left: 5.5%;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  z-index: 2;
}

.header-search.open,
.header-search:focus-within {
  border-bottom-color: #9b6d38;
}

.header-search input {
  width: 0;
  opacity: 0;
  border: 0;
  outline: 0;
  background: transparent;
  transition: .25s;
  font: 11px "DM Sans", sans-serif;
}

.header-search.open input,
.header-search:focus-within input {
  width: 145px;
  opacity: 1;
  padding: 7px;
}

.search-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #242321;
  padding: 5px;
}

.search-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

/* HEADER TOOLS */

.header-tools {
  position: absolute;
  right: 5.5%;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-social,
.footer-social {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-social a {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  color: #242321;
  transition: color .2s, transform .2s;
}

.header-social a:hover,
.footer-social a:hover {
  color: #9b6d38;
  transform: translateY(-2px);
}

.header-social svg,
.footer-social svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-button {
  text-decoration: none;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 12px 15px;
  border: 1px solid #242321;
  transition: .2s;
}

.subscribe-button {
  background: #242321;
  color: #fff;
}

.login-button {
  color: #242321;
  background: transparent;
}

.header-button:hover {
  background: #9b6d38;
  color: white;
  border-color: #9b6d38;
}

.menu-toggle {
  display: none;
}

/* NAVIGATION */

.main-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(12px, 1.8vw, 25px);
  padding: 13px 18px;
  border-top: 1px solid #e7e1d6;
  flex-wrap: wrap;
}

.main-nav a,
.footer-links a {
  font-size: 12px;
  text-decoration: none;
  color: #514b42;
  transition: color .2s;
}

.main-nav a:hover,
.main-nav a.active {
  color: #9b6d38;
}

/* MARKET WATCH */

.market-ribbon {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 13px 5.5%;
  background: #eee9df;
  border-bottom: 1px solid #ded8cc;
  overflow-x: auto;
  white-space: nowrap;
}

.ribbon-label {
  font-size: 9px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: #8b6338;
}

.ribbon-label span {
  font-size: 8px;
  color: #fff;
  background: #9b6d38;
  padding: 3px 5px;
  margin-left: 4px;
}

.ticker {
  display: flex;
  gap: 9px;
  font-size: 10px;
}

.ticker b {
  letter-spacing: .5px;
}

.ticker span,
.market-ribbon small {
  color: #8b8377;
}

.market-ribbon small {
  font-size: 9px;
  margin-left: auto;
}

/* COMMON TEXT */

.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #9b6d38;
  font-weight: 700;
  margin: 0 0 12px;
}

/* EDITORIAL INTRO */

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 70px 8% 35px;
  gap: 30px;
}

.section-heading h1,
.category-intro h2,
.section-title-row h2,
.newsletter h2,
.info-section h2 {
  font-family: "Playfair Display", serif;
  font-weight: 600;
}

.section-heading h1 {
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.08;
  max-width: 680px;
  margin: 0;
}

.section-heading h1 em {
  color: #9a6d3d;
  font-weight: 500;
}

.intro-copy {
  max-width: 280px;
  color: #746e64;
  font-size: 13px;
  line-height: 1.8;
  margin: 0 0 5px;
}

/* HERO STORIES */

.hero-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 18px;
  margin: 0 8% 65px;
}

.lead-story {
  height: 520px;
  position: relative;
  overflow: hidden;
  background: #292621;
}

.lead-story:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.83), transparent 70%);
}

.lead-story img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .83;
}

.lead-overlay {
  position: absolute;
  z-index: 1;
  bottom: 0;
  padding: 38px;
  color: #fff;
  max-width: 650px;
}

.category-label {
  font-size: 10px;
  letter-spacing: 1.7px;
  color: #a77b48;
  font-weight: 700;
}

.lead-overlay .category-label {
  color: #e1bd8c;
}

.lead-overlay h2 {
  font: 600 clamp(30px, 4vw, 48px)/1.1 "Playfair Display", serif;
  margin: 12px 0;
}

.story-summary {
  font-size: 12px;
  line-height: 1.7;
  color: #e0ddd6;
  max-width: 480px;
}

.read-link,
.text-link {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font: 700 9px "DM Sans", sans-serif;
  letter-spacing: 1.4px;
  cursor: pointer;
  text-decoration: none;
}

.read-link {
  display: inline-block;
  margin-top: 14px;
}

.read-link span {
  font-size: 15px;
  margin-left: 7px;
}

.side-stories {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 18px;
}

.side-story {
  background: #ede8de;
  display: grid;
  grid-template-columns: 42% 1fr;
  min-height: 0;
}

.side-story img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-story div {
  padding: 22px 18px;
  align-self: center;
}

.side-story h3 {
  font: 600 21px/1.2 "Playfair Display", serif;
  margin: 10px 0 18px;
}

.text-link {
  color: #8b6338;
  letter-spacing: .5px;
}

/* ADVERTISEMENT SPACES */

.ad-space {
  margin: 45px 8%;
  min-height: 105px;
  border: 1px dashed #cfc5b5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #958a79;
  text-align: center;
}

.ad-space span {
  font-size: 9px;
  letter-spacing: 2px;
}

.ad-space p {
  font-size: 11px;
}

.ad-space-wide {
  min-height: 130px;
}

/* EXPLORE OUR SECTIONS */

.category-intro {
  text-align: center;
  padding: 15px 20px 35px;
}

.category-intro h2 {
  font-size: clamp(28px, 4vw, 42px);
  margin: 0 0 12px;
  text-transform: uppercase;
}

.category-intro > p:last-child {
  font-size: 12px;
  color: #777065;
  max-width: 530px;
  line-height: 1.8;
  margin: auto;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0 8% 85px;
  background: #d8d0c2;
  border: 1px solid #d8d0c2;
}

.category-tile {
  min-height: 185px;
  padding: 25px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-decoration: none;
  color: #fff;
  transition: filter .2s, transform .2s;
}

.category-tile:hover {
  filter: brightness(1.12);
}

.category-tile span {
  font-size: 10px;
  letter-spacing: 1.3px;
  opacity: .9;
  text-transform: uppercase;
}

.category-tile strong {
  font: 600 clamp(22px, 2.5vw, 31px) "Playfair Display", serif;
}

.category-tile small {
  font-size: 11px;
  opacity: .9;
}

/* TILE COLOURS */

.tile-news {
  background: #4a4540;
}

.tile-artha {
  background: #795b3e;
}

.tile-market {
  background: #80613e;
}

.tile-defense {
  background: #394b52;
}

.tile-legal {
  background: #574a4d;
}

.tile-tech {
  background: #405c68;
}

.tile-career {
  background: #70634f;
}

.tile-wellness {
  background: #63705d;
}

.tile-nari {
  background: #875f63;
}

/* LATEST STORIES */

.latest-section {
  padding: 65px 8% 75px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 28px;
}

.section-title-row h2 {
  font-size: clamp(32px, 4vw, 43px);
  margin: 0;
}

.section-title-row > a {
  font-size: 11px;
  color: #8b6338;
  text-decoration: none;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.article-card {
  min-width: 0;
}

.article-card img {
  width: 100%;
  height: 210px;
  object-fit: cover;
  display: block;
  margin-bottom: 17px;
}

.article-card h3 {
  font: 600 22px/1.2 "Playfair Display", serif;
  margin: 9px 0;
}

.article-card p {
  font-size: 11px;
  line-height: 1.7;
  color: #777065;
}

/* NEWSLETTER */

.newsletter {
  margin: 75px 8%;
  padding: 45px 5%;
  background: #292824;
  color: #f8f4eb;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 40px;
  align-items: center;
}

.newsletter h2 {
  font-size: 38px;
  margin: 0 0 10px;
}

.newsletter p:not(.eyebrow):not(.form-note) {
  font-size: 11px;
  color: #c8c1b5;
  line-height: 1.7;
  max-width: 430px;
}

.newsletter-link {
  display: inline-block;
  color: #d7b27e;
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.3px;
  border-bottom: 1px solid #8c8272;
  padding: 12px 0;
}

.form-note {
  font-size: 9px;
  color: #a9a093;
  margin: 0;
}

/* ABOUT / ADVERTISE / CONTACT PREVIEW */

.info-section {
  padding: 50px 8% 75px;
  text-align: center;
}

.info-section h2 {
  font-size: clamp(28px, 4vw, 40px);
  margin: 0 0 30px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #d8d0c2;
  border: 1px solid #d8d0c2;
  text-align: left;
}

.info-grid a {
  background: #eee9df;
  text-decoration: none;
  padding: 27px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 150px;
}

.info-grid a > span {
  color: #9b6d38;
  font-size: 11px;
}

.info-grid strong {
  font: 600 23px "Playfair Display", serif;
}

.info-grid small {
  color: #777065;
  font-size: 11px;
}

/* FOOTER — ORIGINAL CENTRED LAYOUT AND COLOUR */

.site-footer {
  text-align: center;
  background: #eee9df;
  padding: 38px 5.5% 25px;
}

.footer-brand {
  font: 700 25px "Playfair Display", serif;
  letter-spacing: 1px;
  color: #292824;
  text-decoration: none;
}

.site-footer > p {
  font-size: 10px;
  letter-spacing: 2px;
  color: #8b6338;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin: 25px auto;
  max-width: 1100px;
}

.footer-links a {
  font-size: 12px;
}

.footer-links a:hover,
.footer-resources a:hover,
.footer-legal a:hover {
  color: #9b6d38;
}

.footer-category-links {
  margin-top: 32px;
}

.footer-info-links {
  margin-top: 28px;
}

/* USEFUL RESOURCES */

.footer-resources {
  margin: 25px auto;
  max-width: 900px;
  line-height: 2.2;
}

.footer-resources strong {
  display: block;
  font-size: 12px;
  letter-spacing: 1.5px;
  margin-bottom: 7px;
}

.footer-resources a {
  color: #514b42;
  text-decoration: none;
  font-size: 12px;
  margin: 0 8px;
}

/* FOOTER SOCIAL ICONS */

.footer-social {
  justify-content: center;
  margin: 25px 0;
}

.footer-social a {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid #b9ad9b;
  border-radius: 50%;
  color: #514b42;
  text-decoration: none;
  transition: .2s;
}

.footer-social svg {
  width: 18px;
  height: 18px;
}

/* LEGAL LINKS */

.footer-legal {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
  margin: 20px 0;
}

.footer-legal a {
  color: #777065;
  text-decoration: none;
  font-size: 11px;
}

/* ZIGZAG AT THE BOTTOM */

.footer-zigzag {
  width: 100%;
  height: 8px;
  margin: 25px auto 18px;
  background:
    linear-gradient(135deg, transparent 45%, #b8a88f 46%, #b8a88f 53%, transparent 54%) 0 0 / 14px 8px repeat-x;
  opacity: .75;
}

.site-footer > small {
  color: #898174;
  font-size: 10px;
}

/* SUBPAGES */

.page-banner {
  padding: 75px 8% 55px;
  background: #eee9df;
  border-bottom: 1px solid #ded8cc;
}

.page-banner h1 {
  font: 600 clamp(38px, 6vw, 62px) "Playfair Display", serif;
  margin: 0 0 15px;
}

.page-banner p:last-child {
  max-width: 650px;
  color: #746e64;
  font-size: 13px;
  line-height: 1.8;
}

.page-content {
  padding: 55px 8% 80px;
  min-height: 400px;
}

.page-content h2 {
  font: 600 30px "Playfair Display", serif;
}

.page-content h3 {
  font: 600 21px "Playfair Display", serif;
}

.page-content p {
  max-width: 760px;
  color: #625c53;
  line-height: 1.9;
  font-size: 13px;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 35px;
}

.page-actions button {
  background: transparent;
  border: 1px solid #b8aa95;
  color: #514b42;
  padding: 11px 15px;
  font: 700 9px "DM Sans", sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
}

.page-actions button:hover {
  background: #292824;
  color: white;
}

.page-form {
  max-width: 550px;
  display: grid;
  gap: 14px;
  margin-top: 25px;
}

.page-form label {
  display: grid;
  gap: 7px;
  font-size: 11px;
  color: #514b42;
}

.page-form input,
.page-form textarea,
.page-form select {
  width: 100%;
  border: 1px solid #d8d0c2;
  background: #fffdf8;
  padding: 13px;
  font: 12px "DM Sans", sans-serif;
  color: #242321;
}

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

.page-form button {
  justify-self: start;
  padding: 13px 20px;
  background: #292824;
  color: white;
  border: 0;
  cursor: pointer;
  font: 700 10px "DM Sans", sans-serif;
  letter-spacing: 1px;
}

.page-form button:hover {
  background: #9b6d38;
}

.form-response {
  font-size: 12px;
  color: #70634f;
  line-height: 1.6;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 30px;
}

.contact-card {
  border: 1px solid #d8d0c2;
  padding: 23px;
  background: #fffdf8;
}

.contact-card h3 {
  margin-top: 0;
}

.contact-card a {
  color: #8b6338;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.about-highlight {
  border-left: 3px solid #9b6d38;
  padding: 12px 20px;
  margin: 25px 0;
  font: italic 20px/1.6 "Playfair Display", serif;
  color: #514b42;
  max-width: 760px;
}

/* BACK TO TOP */

#back-to-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 48px;
  height: 48px;
  border: 1px solid #9b6d38;
  background: #242321;
  color: white;
  font-size: 25px;
  cursor: pointer;
  z-index: 15;
  display: none;
}

#back-to-top.visible {
  display: block;
}

.search-message {
  padding: 10px 5.5%;
  color: #8b6338;
  font-size: 12px;
}

/* TABLET */

@media (max-width: 1050px) {
  .header-tools {
    right: 3%;
    gap: 8px;
  }

  .header-social {
    gap: 5px;
  }

  .header-button {
    padding: 10px;
    font-size: 8px;
  }

  .header-search {
    left: 3%;
  }

  .main-nav {
    gap: 13px;
  }

  .main-nav a {
    font-size: 11px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .lead-story {
    height: 440px;
  }

  .side-stories {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 220px;
  }

  .side-story {
    grid-template-columns: 1fr;
    grid-template-rows: 95px 1fr;
  }

  .side-story img {
    height: 95px;
  }

  .side-story div {
    padding: 12px;
  }

  .side-story h3 {
    font-size: 17px;
    margin: 6px 0;
  }
}

/* MOBILE */

@media (max-width: 700px) {
  .topline {
    font-size: 7px;
    letter-spacing: .8px;
    padding: 9px 4%;
  }

  .header-main {
    min-height: 100px;
  }

  .brand {
    padding: 15px 8px;
  }

  .brand-name {
    font-size: 34px;
  }

  .brand-tagline {
    font-size: 7px;
  }

  .header-search {
    left: 12px;
    top: 19px;
    transform: none;
  }

  .header-search.open input,
  .header-search:focus-within input {
    width: 105px;
  }

  .header-tools {
    position: static;
    transform: none;
    justify-content: center;
    padding: 0 10px 12px;
    flex-wrap: wrap;
  }

  .header-social {
    display: none;
  }

  .header-button {
    padding: 9px 12px;
  }

  .menu-toggle {
    display: block;
    position: absolute;
    right: 15px;
    top: 17px;
    border: 0;
    background: none;
    font-size: 21px;
    color: #292824;
    cursor: pointer;
  }

  .main-nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 24px;
  }

  .main-nav.open {
    display: flex;
  }

  .main-nav a {
    padding: 8px 0;
    border-bottom: 1px solid #e7e1d6;
    font-size: 12px;
  }

  .market-ribbon {
    gap: 18px;
    padding: 12px 5%;
  }

  .market-ribbon small {
    display: none;
  }

  .section-heading {
    display: block;
    padding: 48px 6% 25px;
  }

  .section-heading h1 {
    font-size: 42px;
  }

  .intro-copy {
    margin-top: 18px;
  }

  .hero-grid {
    margin: 0 6% 50px;
  }

  .lead-story {
    height: 430px;
  }

  .lead-overlay {
    padding: 24px;
  }

  .side-stories {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .side-story {
    grid-template-columns: 38% 1fr;
    grid-template-rows: 150px;
  }

  .side-story img {
    height: 150px;
  }

  .side-story div {
    padding: 15px;
  }

  .side-story h3 {
    font-size: 18px;
  }

  .category-grid {
    margin: 0 6% 55px;
    grid-template-columns: 1fr 1fr;
  }

  .category-tile {
    min-height: 150px;
    padding: 16px;
  }

  .category-tile strong {
    font-size: 20px;
  }

  .category-tile span {
    font-size: 8px;
  }

  .latest-section {
    padding: 48px 6%;
  }

  .section-title-row {
    align-items: start;
    gap: 10px;
  }

  .section-title-row > a {
    padding-top: 20px;
    white-space: nowrap;
  }

  .article-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .article-card img {
    height: 220px;
  }

  .newsletter {
    margin: 50px 6%;
    padding: 30px 22px;
    grid-template-columns: 1fr;
  }

  .newsletter h2 {
    font-size: 32px;
  }

  .info-section {
    padding: 40px 6%;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .footer-links {
    gap: 13px 17px;
  }

  .footer-category-links {
    padding: 0 10px;
  }

  .footer-resources a {
    display: inline-block;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .page-banner,
  .page-content {
    padding-left: 6%;
    padding-right: 6%;
  }

  #back-to-top {
    right: 15px;
    bottom: 15px;
  }
}

@media (max-width: 390px) {
  .category-grid {
    grid-template-columns: 1fr;
  }

  .brand-name {
    font-size: 30px;
  }

  .footer-links {
    flex-direction: column;
  }
}

/* PRINT / SAVE PDF */

@media print {
  .topline,
  .site-header,
  .page-actions,
  .site-footer,
  #back-to-top,
  .ad-space {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .page-content,
  .page-banner {
    padding: 20px;
  }
}
/* DESKTOP HEADER LAYOUT */
@media (min-width: 701px) {
  .header-main {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    min-height: 180px;
    padding: 0 5.5%;
  }

  .brand {
    grid-column: 2;
    grid-row: 1;
  }

  .header-tools {
    position: static !important;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    transform: none !important;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 16px;
    width: max-content;
    padding: 0;
  }
}



js------->.                 // ========================================
// DATE, TIME AND YEAR — INDIA STANDARD TIME
// ========================================

function updateDateAndTime() {
  const now = new Date();

  const dateElement = document.getElementById("today-date");
  const timeElement = document.getElementById("today-time");
  const yearElement = document.getElementById("year");

  if (dateElement) {
    dateElement.textContent = now.toLocaleDateString("en-IN", {
      timeZone: "Asia/Kolkata",
      weekday: "long",
      day: "numeric",
      month: "long",
      year: "numeric"
    }).toUpperCase();
  }

  if (timeElement) {
    timeElement.textContent = now.toLocaleTimeString("en-IN", {
      timeZone: "Asia/Kolkata",
      hour: "2-digit",
      minute: "2-digit",
      hour12: true
    });
  }

  if (yearElement) {
    yearElement.textContent = now.getFullYear();
  }
}

updateDateAndTime();
setInterval(updateDateAndTime, 60000);


// ========================================
// MOBILE NAVIGATION
// ========================================

const menuToggle = document.getElementById("menu-toggle");
const mainNav = document.getElementById("main-nav");

if (menuToggle && mainNav) {
  menuToggle.addEventListener("click", () => {
    const isOpen = mainNav.classList.toggle("open");

    menuToggle.setAttribute("aria-expanded", String(isOpen));
    menuToggle.setAttribute(
      "aria-label",
      isOpen ? "Close navigation" : "Open navigation"
    );

    menuToggle.textContent = isOpen ? "×" : "☰";
  });

  mainNav.querySelectorAll("a").forEach(link => {
    link.addEventListener("click", () => {
      mainNav.classList.remove("open");
      menuToggle.setAttribute("aria-expanded", "false");
      menuToggle.textContent = "☰";
    });
  });
}


// ========================================
// ACTIVE NAVIGATION LINK
// ========================================

const currentPage = window.location.pathname.split("/").pop();
const currentParams = new URLSearchParams(window.location.search);

document.querySelectorAll(".main-nav a").forEach(link => {
  const linkURL = new URL(link.href, window.location.href);
  const linkPage = linkURL.pathname.split("/").pop();
  const linkName = linkURL.searchParams.get("name");
  const currentName = currentParams.get("name");

  const isHome =
    (currentPage === "" || currentPage === "index.html") &&
    linkPage === "index.html";

  const isSection =
    currentPage === "section.html" &&
    linkPage === "section.html" &&
    linkName === currentName;

  if (isHome || isSection) {
    link.classList.add("active");
  } else {
    link.classList.remove("active");
  }
});


// ========================================
// SEARCH
// ========================================

const searchForm = document.getElementById("site-search-form");
const searchInput = document.getElementById("site-search");
const searchToggle = document.getElementById("search-toggle");

searchToggle?.addEventListener("click", () => {
  const isOpen = searchForm.classList.toggle("open");

  searchToggle.setAttribute("aria-expanded", String(isOpen));

  if (isOpen) {
    searchInput.focus();
  } else {
    searchInput.value = "";
    resetSearch();
  }
});

function resetSearch() {
  document.querySelectorAll(".story-card, .article-card").forEach(card => {
    card.style.display = "";
  });

  const message = document.getElementById("search-message");
  if (message) message.remove();
}

searchInput?.addEventListener("input", () => {
  const term = searchInput.value.trim().toLowerCase();

  const cards = document.querySelectorAll(".story-card, .article-card");
  let found = 0;

  cards.forEach(card => {
    const matches = card.textContent.toLowerCase().includes(term);

    card.style.display = matches ? "" : "none";

    if (matches) found++;
  });

  let message = document.getElementById("search-message");

  if (!message) {
    message = document.createElement("p");
    message.id = "search-message";
    message.className = "search-message";
    searchForm.insertAdjacentElement("afterend", message);
  }

  if (!term) {
    message.remove();
    resetSearch();
    return;
  }

  message.textContent = found
    ? `${found} matching item(s) found on this page.`
    : "No matching stories found on this page.";
});

searchForm?.addEventListener("submit", event => {
  event.preventDefault();

  const term = searchInput.value.trim();

  if (!term) {
    searchInput.focus();
    return;
  }

  searchInput.dispatchEvent(new Event("input"));
});


// ========================================
// BACK TO TOP
// ========================================

const backToTop = document.getElementById("back-to-top");

if (backToTop) {
  window.addEventListener("scroll", () => {
    backToTop.classList.toggle("visible", window.scrollY > 400);
  });

  backToTop.addEventListener("click", () => {
    window.scrollTo({
      top: 0,
      behavior: "smooth"
    });
  });
}


// ========================================
// SHARE PAGE
// ========================================

const shareButton = document.getElementById("share-page");

shareButton?.addEventListener("click", async () => {
  const shareData = {
    title: document.title,
    text: "Explore The News Wealth",
    url: window.location.href
  };

  if (navigator.share) {
    try {
      await navigator.share(shareData);
    } catch (error) {
      // Visitor may close the share window.
    }
  } else {
    copyCurrentLink();
  }
});


// ========================================
// COPY LINK
// ========================================

async function copyCurrentLink() {
  try {
    await navigator.clipboard.writeText(window.location.href);
    alert("Page link copied.");
  } catch (error) {
    alert("Please copy the page link from your browser address bar.");
  }
}

document.getElementById("copy-page")?.addEventListener("click", copyCurrentLink);


// ========================================
// PRINT / SAVE AS PDF
// ========================================

document.getElementById("print-page")?.addEventListener("click", () => {
  window.print();
});


// ========================================
// PREVIEW FORMS
// ========================================

document.querySelectorAll(".page-form").forEach(form => {
  form.addEventListener("submit", event => {
    event.preventDefault();

    const note = form.querySelector(".form-response");

    if (note) {
      note.textContent =
        "Thank you for your interest. This is currently a website preview; your information has not been submitted or stored.";
    }
  });
});

/* REQUESTED EDITIONS — AD SPACE, GOLD BRANDING, SOCIAL PLACEMENT */
.ad-space-top {
  min-height: 74px; margin: 0; padding: 12px 5.5%; display: flex;
  align-items: center; justify-content: center; gap: 14px;
  background: #eee9df; border-bottom: 1px solid #ded8cc; text-align: center;
}
.ad-space-top span { color: #9b6d38; font-size: 9px; letter-spacing: 2px; }
.ad-space-top p { margin: 0; color: #8d877d; font-size: 11px; }
.brand-kicker { color: #b08a4d; font-weight: 700; }
.brand-tagline { color: #9b7844; }
.header-tools { flex-direction: column; align-items: center; gap: 7px; }
.header-social { order: 3; gap: 10px; }
.header-social a { width: 23px; height: 23px; }
.header-social svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.category-tile { position: relative; }
.tile-explore { display: inline-block; margin-top: 16px; padding: 8px 13px; border: 1px solid currentColor; font-size: 9px; letter-spacing: 1.3px; }
.site-footer { background: #252421 !important; color: #f7f4ed !important; }
.site-footer a { color: #f7f4ed; }
.footer-ownership { display: block; line-height: 1.9; color: #d9d1c1; font-size: 10px; letter-spacing: .25px; }
.footer-logo { display: inline-block; width: 88px; height: auto; vertical-align: middle; background: transparent; }
.inline-logo { display: inline-block; width: 130px; height: auto; vertical-align: middle; }
.article-card h3 a, .lead-story h2 a, .side-story h3 a { color: inherit; text-decoration: none; }
.article-card h3 a:hover, .lead-story h2 a:hover, .side-story h3 a:hover { color: #9b6d38; }
@media (max-width: 900px) { .header-tools { right: 4%; gap: 5px; } .header-social { gap: 5px; } }
@media (max-width: 680px) { .ad-space-top { min-height: 58px; flex-direction: column; gap: 4px; } .header-tools { position: static; transform: none; margin: 0 0 10px; } .header-main { flex-wrap: wrap; padding-bottom: 8px; } .brand { padding-bottom: 5px; } }

.story-page { max-width: 900px; }
.story-page article { max-width: 760px; margin: 30px auto; font-size: 16px; line-height: 1.9; }
.editorial-placeholder { margin-top: 30px; padding: 18px; background: #eee9df; border-left: 3px solid #b08a4d; color: #6f675b; font-size: 13px; }
.section-empty { grid-column: 1 / -1; padding: 30px; color: #777064; background: #eee9df; }
@media print { .site-header, .topline, .ad-space, .ad-space-top, .page-actions, .site-footer, #back-to-top { display:none !important; } body { background:#fff; } .page-content { padding:0; } }

/* HEADER SEARCH: stacked above Subscribe on every page */
.header-tools .header-search {
  position: static;
  left: auto;
  top: auto;
  transform: none;
  order: 0;
  justify-content: center;
  min-height: 30px;
}
.header-tools .subscribe-button { order: 1; }
.header-tools .login-button { order: 2; }
.header-tools .header-social { order: 3; }
.header-tools { flex-direction: column; align-items: center; gap: 7px; }

@media (max-width: 700px) {
  .header-tools { position: static; transform: none; margin: 0 auto 10px; }
  .header-tools .header-search { position: static; top: auto; left: auto; transform: none; }
  .header-tools .header-social { display: flex; }
  .header-tools .header-search.open input,
  .header-tools .header-search:focus-within input { width: 125px; }
}


/* USER REQUESTED HEADER ORDER: SUBSCRIBE / LOGIN, SOCIAL ICONS, SEARCH */
.header-tools {
  position: absolute;
  right: 5.5%;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 205px;
}
.header-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  order: 1;
}
.header-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  order: 2;
}
.header-tools .header-search {
  position: static !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;
  order: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 190px;
  min-height: 30px;
  border-bottom: 1px solid #b8aa95;
}
.header-tools .header-search input,
.header-tools .header-search.open input,
.header-tools .header-search:focus-within input {
  width: 150px;
  opacity: 1;
  padding: 7px;
}
.header-tools .header-search .search-icon { flex: 0 0 30px; }

/* TRANSPARENT LOGO ASSETS: white footer mark, original navy/gold About Us mark */
.footer-ownership {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.8;
  text-align: center;
  color: #d9d1c1;
  font-size: 10px;
  letter-spacing: .25px;
}
.footer-publication {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.footer-logo {
  display: inline-block;
  width: 105px;
  height: auto;
  max-height: 48px;
  object-fit: contain;
  vertical-align: middle;
  background: transparent !important;
}
.inline-logo {
  display: inline-block;
  width: 130px;
  height: auto;
  max-height: 48px;
  object-fit: contain;
  vertical-align: middle;
  background: transparent !important;
}

@media (min-width: 701px) {
  .header-tools {
    position: static !important;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    transform: none !important;
    width: 205px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
}
@media (max-width: 700px) {
  .header-main {
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 8px;
  }
  .brand { padding: 15px 8px 5px; }
  .header-tools {
    position: static !important;
    transform: none !important;
    width: 100%;
    margin: 0 auto 10px;
    padding: 0 10px 8px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .header-social { display: flex !important; }
  .header-tools .header-search { width: 190px; }
  .header-tools .header-search input,
  .header-tools .header-search.open input,
  .header-tools .header-search:focus-within input { width: 150px; }
  .menu-toggle { top: 17px; right: 15px; }
}


/* SECTION STORY GRID — consistent editorial cards for all nine sections */
.section-card-image-link { display:block; overflow:hidden; }
.section-card-image-link img { width:100%; height: min(19vw, 340px); min-height:210px; object-fit:cover; display:block; transition:transform .35s ease; }
.section-card-image-link:hover img { transform:scale(1.035); }
#section-stories .article-card { display:flex; flex-direction:column; align-items:flex-start; }
#section-stories .category-label { margin-top:0; color:#bd9862; letter-spacing:2.5px; font-size:10px; font-weight:700; }
#section-stories .article-card h3 { font-size:clamp(20px, 2vw, 27px); line-height:1.28; margin:10px 0; }
#section-stories .article-card p { font-size:13px; line-height:1.65; color:#81796e; }
#section-stories .text-link { margin-top:auto; padding-top:10px; }
.section-tagline-title { text-transform:none !important; font-variant:normal; }
@media(max-width:900px) { #section-stories .section-card-image-link img { height:240px; } }
@media(max-width:680px) { #section-stories { grid-template-columns:1fr; gap:32px; } #section-stories .section-card-image-link img { height:230px; } }


/* SECTION PAGE HEADER — category number, title and explore link */
.section-page-banner { padding-top:55px; padding-bottom:36px; background:#f7f4ed; }
.section-banner-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; }
.section-banner-heading h1 { margin:0; }
.section-banner-heading > a { color:#9b6d38; font-size:12px; font-weight:700; text-decoration:none; white-space:nowrap; padding-bottom:12px; }
.section-banner-heading > a:hover { text-decoration:underline; }
.section-page-banner #section-description { margin:12px 0 0; }
@media(max-width:600px) { .section-banner-heading { align-items:flex-start; flex-direction:column; gap:8px; } .section-banner-heading > a { padding-bottom:0; } }


/* HOMEPAGE: EDITORIAL STORY ROWS BELOW THE NINE COLOUR TILES */
.home-editorial-sections { margin: -35px 8% 85px; }
.home-editorial-section { padding: 48px 0 54px; border-bottom: 1px solid #d8d0c2; }
.home-editorial-section:last-child { border-bottom: 0; }
.home-editorial-heading { display:flex; align-items:end; justify-content:space-between; gap:20px; margin-bottom:26px; }
.home-editorial-heading .eyebrow { margin:0 0 10px; color:#a8753d; font-size:10px; font-weight:700; letter-spacing:2.5px; text-transform:uppercase; }
.home-editorial-heading h2 { margin:0; color:#242321; font:600 clamp(30px,4.2vw,48px)/1.12 "Playfair Display",Georgia,serif; }
.home-editorial-heading > a { flex:0 0 auto; margin-bottom:7px; color:#9a6b35; font-size:12px; font-weight:700; text-decoration:none; }
.home-editorial-heading > a:hover { text-decoration:underline; }
.home-editorial-cards { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:28px; }
.home-editorial-card { min-width:0; }
.home-editorial-card .section-card-image-link { display:block; overflow:hidden; }
.home-editorial-card .section-card-image-link img { display:block; width:100%; height:clamp(190px,19vw,340px); object-fit:cover; transition:transform .35s ease; }
.home-editorial-card .section-card-image-link:hover img { transform:scale(1.035); }
.home-editorial-card .category-label { display:block; margin:25px 0 12px; color:#bd9862; font-size:10px; font-weight:700; letter-spacing:2.5px; }
.home-editorial-card h3 { margin:0 0 14px; font:600 clamp(20px,2vw,27px)/1.3 "Playfair Display",Georgia,serif; }
.home-editorial-card h3 a { color:#242321; text-decoration:none; }
.home-editorial-card h3 a:hover { color:#9a6b35; }
.home-editorial-card p { margin:0 0 16px; color:#81796d; font-size:13px; line-height:1.7; }
.home-editorial-card .text-link { color:#9a6b35; font-size:10px; font-weight:700; letter-spacing:1.2px; text-decoration:none; }
@media(max-width:900px) { .home-editorial-sections { margin-left:5%; margin-right:5%; } .home-editorial-cards { gap:18px; } .home-editorial-card .section-card-image-link img { height:230px; } }
@media(max-width:680px) { .home-editorial-sections { margin:-25px 5% 55px; } .home-editorial-section { padding:34px 0 38px; } .home-editorial-heading { align-items:flex-start; flex-direction:column; gap:8px; } .home-editorial-cards { grid-template-columns:1fr; gap:30px; } .home-editorial-card .section-card-image-link img { height:230px; } .home-editorial-card .category-label { margin-top:16px; } }
